diff --git a/Doxyfile b/Doxyfile index 58d7f0a89a..251b36be15 100644 --- a/Doxyfile +++ b/Doxyfile @@ -8,9 +8,14 @@ #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- +DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = OpenTTD +PROJECT_NUMBER = +PROJECT_BRIEF = +PROJECT_LOGO = OUTPUT_DIRECTORY = docs/source/ -CREATE_SUBDIRS = NO +CREATE_SUBDIRS = YES +ALLOW_UNICODE_NAMES = NO OUTPUT_LANGUAGE = English BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES @@ -32,22 +37,42 @@ STRIP_FROM_PATH = ./ STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES +QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO INHERIT_DOCS = YES -DISTRIBUTE_GROUP_DOC = NO +SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 2 ALIASES = +TCL_SUBST = OPTIMIZE_OUTPUT_FOR_C = YES OPTIMIZE_OUTPUT_JAVA = NO +OPTIMIZE_FOR_FORTRAN = NO +OPTIMIZE_OUTPUT_VHDL = NO +EXTENSION_MAPPING = +MARKDOWN_SUPPORT = YES +TOC_INCLUDE_HEADINGS = 0 +AUTOLINK_SUPPORT = YES +BUILTIN_STL_SUPPORT = NO +CPP_CLI_SUPPORT = NO +SIP_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES +DISTRIBUTE_GROUP_DOC = NO +GROUP_NESTED_COMPOUNDS = NO SUBGROUPING = YES +INLINE_GROUPED_CLASSES = NO +INLINE_SIMPLE_STRUCTS = NO +TYPEDEF_HIDES_STRUCT = NO +LOOKUP_CACHE_SIZE = 0 #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = NO EXTRACT_PRIVATE = YES +EXTRACT_PACKAGE = NO EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = YES +EXTRACT_ANON_NSPACES = YES HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO @@ -55,11 +80,17 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO +HIDE_COMPOUND_REFERENCE= NO SHOW_INCLUDE_FILES = YES +SHOW_GROUPED_MEMB_INC = NO +FORCE_LOCAL_INCLUDES = NO INLINE_INFO = YES SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO +SORT_MEMBERS_CTORS_1ST = NO +SORT_GROUP_NAMES = NO SORT_BY_SCOPE_NAME = NO +STRICT_PROTO_MATCHING = NO GENERATE_TODOLIST = YES GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES @@ -67,22 +98,27 @@ GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES -SHOW_DIRECTORIES = YES +SHOW_FILES = YES +SHOW_NAMESPACES = YES FILE_VERSION_FILTER = +LAYOUT_FILE = +CITE_BIB_FILES = #--------------------------------------------------------------------------- -# configuration options related to warning and progress messages +# Configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO +WARN_AS_ERROR = NO WARN_FORMAT = "$file:$line: $text" WARN_LOGFILE = #--------------------------------------------------------------------------- -# configuration options related to the input files +# Configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ./src/ +INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.c \ *.cc \ *.cxx \ @@ -93,31 +129,38 @@ FILE_PATTERNS = *.c \ RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = */3rdparty */.svn */script/api +EXCLUDE_PATTERNS = */3rdparty \ + */script/api +EXCLUDE_SYMBOLS = EXAMPLE_PATH = EXAMPLE_PATTERNS = * EXAMPLE_RECURSIVE = NO -IMAGE_PATH =./docs/ +IMAGE_PATH = ./docs/ INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO +FILTER_SOURCE_PATTERNS = +USE_MDFILE_AS_MAINPAGE = #--------------------------------------------------------------------------- -# configuration options related to source browsing +# Configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES +REFERENCES_LINK_SOURCE = YES +SOURCE_TOOLTIPS = YES +USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index +# Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = NO COLS_IN_ALPHA_INDEX = 5 IGNORE_PREFIX = #--------------------------------------------------------------------------- -# configuration options related to the HTML output +# Configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html @@ -125,19 +168,58 @@ HTML_FILE_EXTENSION = .html HTML_HEADER = HTML_FOOTER = HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = YES +HTML_EXTRA_STYLESHEET = +HTML_EXTRA_FILES = +HTML_COLORSTYLE_HUE = 220 +HTML_COLORSTYLE_SAT = 100 +HTML_COLORSTYLE_GAMMA = 80 +HTML_TIMESTAMP = NO +HTML_DYNAMIC_MENUS = YES +HTML_DYNAMIC_SECTIONS = NO +HTML_INDEX_NUM_ENTRIES = 100 +GENERATE_DOCSET = NO +DOCSET_FEEDNAME = "Doxygen generated docs" +DOCSET_BUNDLE_ID = org.doxygen.Project +DOCSET_PUBLISHER_ID = org.doxygen.Publisher +DOCSET_PUBLISHER_NAME = Publisher +GENERATE_HTMLHELP = NO CHM_FILE = HHC_LOCATION = GENERATE_CHI = NO +CHM_INDEX_ENCODING = BINARY_TOC = NO TOC_EXPAND = YES +GENERATE_QHP = NO +QCH_FILE = +QHP_NAMESPACE = org.doxygen.Project +QHP_VIRTUAL_FOLDER = doc +QHP_CUST_FILTER_NAME = +QHP_CUST_FILTER_ATTRS = +QHP_SECT_FILTER_ATTRS = +QHG_LOCATION = +GENERATE_ECLIPSEHELP = NO +ECLIPSE_DOC_ID = org.doxygen.Project DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = YES +ENUM_VALUES_PER_LINE = 4 TREEVIEW_WIDTH = 250 +EXT_LINKS_IN_WINDOW = NO +FORMULA_FONTSIZE = 10 +FORMULA_TRANSPARENT = YES +USE_MATHJAX = NO +MATHJAX_FORMAT = HTML-CSS +MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/ +MATHJAX_EXTENSIONS = +MATHJAX_CODEFILE = +SEARCHENGINE = NO +SERVER_BASED_SEARCH = NO +EXTERNAL_SEARCH = NO +SEARCHENGINE_URL = +SEARCHDATA_FILE = searchdata.xml +EXTERNAL_SEARCH_ID = +EXTRA_SEARCH_MAPPINGS = #--------------------------------------------------------------------------- -# configuration options related to the LaTeX output +# Configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO LATEX_OUTPUT = latex @@ -147,12 +229,18 @@ COMPACT_LATEX = NO PAPER_TYPE = a4wide EXTRA_PACKAGES = LATEX_HEADER = +LATEX_FOOTER = +LATEX_EXTRA_STYLESHEET = +LATEX_EXTRA_FILES = PDF_HYPERLINKS = NO USE_PDFLATEX = NO LATEX_BATCHMODE = NO LATEX_HIDE_INDICES = NO +LATEX_SOURCE_CODE = NO +LATEX_BIB_STYLE = plain +LATEX_TIMESTAMP = NO #--------------------------------------------------------------------------- -# configuration options related to the RTF output +# Configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf @@ -160,27 +248,33 @@ COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = +RTF_SOURCE_CODE = NO #--------------------------------------------------------------------------- -# configuration options related to the man page output +# Configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 +MAN_SUBDIR = MAN_LINKS = NO #--------------------------------------------------------------------------- -# configuration options related to the XML output +# Configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output +# Configuration options related to the DOCBOOK output +#--------------------------------------------------------------------------- +GENERATE_DOCBOOK = NO +DOCBOOK_OUTPUT = docbook +DOCBOOK_PROGRAMLISTING = NO +#--------------------------------------------------------------------------- +# Configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- -# configuration options related to the Perl module output +# Configuration options related to the Perl module output #--------------------------------------------------------------------------- GENERATE_PERLMOD = NO PERLMOD_LATEX = NO @@ -195,42 +289,67 @@ EXPAND_ONLY_PREDEF = YES SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = -PREDEFINED = ENABLE_NETWORK WITH_ZLIB WITH_LZO WITH_LZMA WITH_SDL WITH_PNG WITH_FONTCONFIG WITH_FREETYPE WITH_ICU_SORT WITH_ICU_LAYOUT UNICODE _UNICODE _GNU_SOURCE FINAL= +PREDEFINED = ENABLE_NETWORK \ + WITH_ZLIB \ + WITH_LZO \ + WITH_LZMA \ + WITH_SDL \ + WITH_PNG \ + WITH_FONTCONFIG \ + WITH_FREETYPE \ + WITH_ICU_SORT \ + WITH_ICU_LAYOUT \ + UNICODE \ + _UNICODE \ + _GNU_SOURCE \ + FINAL= EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- -# Configuration::additions related to external references +# Configuration options related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = objs/openttd.tag ALLEXTERNALS = NO EXTERNAL_GROUPS = YES +EXTERNAL_PAGES = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES +MSCGEN_PATH = +DIA_PATH = HIDE_UNDOC_RELATIONS = YES HAVE_DOT = NO +DOT_NUM_THREADS = 0 +DOT_FONTNAME = Helvetica +DOT_FONTSIZE = 10 +DOT_FONTPATH = CLASS_GRAPH = YES COLLABORATION_GRAPH = YES GROUP_GRAPHS = YES UML_LOOK = NO +UML_LIMIT_NUM_FIELDS = 10 TEMPLATE_RELATIONS = NO INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES CALL_GRAPH = NO +CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = png +INTERACTIVE_SVG = NO DOT_PATH = DOTFILE_DIRS = +MSCFILE_DIRS = +DIAFILE_DIRS = +PLANTUML_JAR_PATH = +PLANTUML_CFG_FILE = +PLANTUML_INCLUDE_PATH = +DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 1000 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/config.lib b/config.lib index 7e5e9988fb..3a4c1025e4 100644 --- a/config.lib +++ b/config.lib @@ -83,6 +83,7 @@ set_default() { with_midi="" with_midi_arg="" with_libtimidity="1" + with_fluidsynth="1" with_freetype="1" with_fontconfig="1" with_icu_layout="1" @@ -163,6 +164,7 @@ set_default() { with_midi with_midi_arg with_libtimidity + with_fluidsynth with_freetype with_fontconfig with_icu_layout @@ -378,6 +380,9 @@ detect_params() { --without-libtimidity) with_libtimidity="0";; --with-libtimidity=*) with_libtimidity="$optarg";; + --with-fluidsynth) with_fluidsynth="2";; + --without-fluidsynth) with_fluidsynth="0";; + --with-freetype) with_freetype="2";; --without-freetype) with_freetype="0";; --with-freetype=*) with_freetype="$optarg";; @@ -914,6 +919,7 @@ check_params() { detect_icu_layout detect_icu_sort detect_libtimidity + detect_fluidsynth if [ "$with_direct_music" != "0" ]; then if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then @@ -2141,6 +2147,11 @@ EOL fi fi + if [ -n "$fluidsynth" ]; then + LIBS="$LIBS -lfluidsynth" + CFLAGS="$CFLAGS -DFLUIDSYNTH" + fi + if [ "$with_iconv" != "0" ]; then CFLAGS="$CFLAGS -DWITH_ICONV" if [ "$link_to_iconv" = "yes" ]; then @@ -3095,6 +3106,10 @@ detect_libtimidity() { detect_pkg_config "$with_libtimidity" "libtimidity" "libtimidity_config" "0.1" "1" } +detect_fluidsynth() { + detect_library "$with_fluidsynth" "fluidsynth" "" "" "fluidsynth.h" +} + detect_pkg_config() { # $1 - config-param ($with_lzma value) # $2 - package name ('liblzma') @@ -3882,6 +3897,7 @@ showhelp() { echo " midi-player" echo " --with-libtimidity[=\"pkg-config libtimidity\"]" echo " enables libtimidity support" + echo " --with-fluidsynth enables fluidsynth support" echo " --with-allegro[=\"pkg-config allegro\"]" echo " enables Allegro video driver support" echo " --with-cocoa enables COCOA video driver (OSX ONLY)" diff --git a/configure b/configure index 7ca36480d3..afc1de51b4 100755 --- a/configure +++ b/configure @@ -125,6 +125,7 @@ AWKCOMMAND=' if ($0 == "MSVC" && "'$os'" != "MSVC") { next; } if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; } if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; } + if ($0 == "FLUIDSYNTH" && "'$fluidsynth'" == "" ) { next; } if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; } if ($0 == "SSE" && "'$with_sse'" != "1") { next; } diff --git a/projects/generate b/projects/generate index 28fd255527..4351337a25 100755 --- a/projects/generate +++ b/projects/generate @@ -74,6 +74,7 @@ enable_dedicated="0" enable_ai="1" with_cocoa="0" enable_directmusic="1" +enable_fluidsynth="0" with_threads="1" file_prefix="..\\\\src\\\\" @@ -132,6 +133,7 @@ load_main_data() { "'$os'" != "CYGWIN" && "'$os'" != "MSVC" ) { next; } if ($0 == "MSVC" && "'$os'" != "MSVC") { next; } if ($0 == "DIRECTMUSIC" && "'$enable_directmusic'" != "1") { next; } + if ($0 == "FLUIDSYNTH" && "'$enable_fluidsynth'" != "1") { next; } if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; } if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; } diff --git a/source.list b/source.list index b331d2c17f..5933b0f9dc 100644 --- a/source.list +++ b/source.list @@ -441,6 +441,7 @@ music/bemidi.h music/cocoa_m.h music/extmidi.h music/libtimidity.h +music/fluidsynth.h music/os2_m.h music/qtmidi.h os/macosx/macos.h @@ -1182,6 +1183,9 @@ music/midifile.cpp #if LIBTIMIDITY music/libtimidity.cpp #end +#if FLUIDSYNTH + music/fluidsynth.cpp +#end #end # Sound diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index fa2d2f4ad2..d333840dfc 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -252,7 +252,7 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoff * @param flags type of operation. * @param e the engine to build. * @param data unused. - * @param ret[out] the vehicle that has been built. + * @param[out] ret the vehicle that has been built. * @return the cost of this operation or an error. */ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret) @@ -649,6 +649,13 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, * and take-off speeds being too low. */ speed_limit *= _settings_game.vehicle.plane_speed; + /* adjust speed for broken vehicles */ + if (v->breakdown_ctr == 1 && v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED) { + const uint broken_speed = v->breakdown_severity << 3; + if (broken_speed < speed_limit) hard_limit = false; + speed_limit = min(speed_limit, broken_speed); + } + if (v->vcache.cached_max_speed < speed_limit) { if (v->cur_speed < speed_limit) hard_limit = false; speed_limit = v->vcache.cached_max_speed; @@ -668,9 +675,6 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE, spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit); - /* adjust speed for broken vehicles */ - if (v->breakdown_ctr == 1 && v->breakdown_type == BREAKDOWN_AIRCRAFT_SPEED) spd = min(v->breakdown_severity << 3, spd); - /* updates statusbar only if speed have changed to save CPU time */ if (spd != v->cur_speed) { v->cur_speed = spd; @@ -708,9 +712,9 @@ int GetTileHeightBelowAircraft(const Vehicle *v) * When the maximum is reached the vehicle should consider descending. * When the minimum is reached the vehicle should consider ascending. * - * @param v The vehicle to get the flight levels for. - * @param [out] min_level The minimum bounds for flight level. - * @param [out] max_level The maximum bounds for flight level. + * @param v The vehicle to get the flight levels for. + * @param[out] min_level The minimum bounds for flight level. + * @param[out] max_level The maximum bounds for flight level. */ void GetAircraftFlightLevelBounds(const Vehicle *v, int *min_level, int *max_level) { @@ -742,7 +746,7 @@ void GetAircraftFlightLevelBounds(const Vehicle *v, int *min_level, int *max_lev /** * Gets the maximum 'flight level' for the holding pattern of the aircraft, - * in pixels 'z_pos' 0, depending on terrain below.. + * in pixels 'z_pos' 0, depending on terrain below. * * @param v The aircraft that may or may not need to decrease its altitude. * @return Maximal aircraft holding altitude, while in normal flight, in pixels. @@ -1964,7 +1968,7 @@ static bool FreeTerminal(Aircraft *v, byte i, byte last_terminal) /** * Get the number of terminals at the airport. - * @param afc Airport description. + * @param apc Airport description. * @return Number of terminals. */ static uint GetNumTerminals(const AirportFTAClass *apc) diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp index 7c06dec04c..547d5c5b8b 100644 --- a/src/autoreplace_cmd.cpp +++ b/src/autoreplace_cmd.cpp @@ -33,7 +33,6 @@ extern void ChangeVehicleViewWindow(VehicleID from_index, VehicleID to_index); * Figure out if two engines got at least one type of cargo in common (refitting if needed) * @param engine_a one of the EngineIDs * @param engine_b the other EngineID - * @param type the type of the engines * @return true if they can both carry the same type of cargo (or at least one of them got no capacity at all) */ static bool EnginesHaveCargoInCommon(EngineID engine_a, EngineID engine_b) @@ -239,7 +238,7 @@ static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type, bool * @param c The vehicle's owner (it's faster to forward the pointer than refinding it) * @param always_replace Always replace, even if not old. * @param same_type_only Only replace with same engine type. - * @param [out] e the EngineID of the replacement. INVALID_ENGINE if no replacement is found + * @param[out] e the EngineID of the replacement. INVALID_ENGINE if no replacement is found * @return Error if the engine to build is not available */ static CommandCost GetNewEngineType(const Vehicle *v, const Company *c, bool always_replace, bool same_type_only, EngineID &e) diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp index 1074d1dd78..eae0a378eb 100644 --- a/src/autoreplace_gui.cpp +++ b/src/autoreplace_gui.cpp @@ -81,7 +81,7 @@ class ReplaceVehicleWindow : public Window { EngineID sel_engine[2]; ///< Selected engine left and right. GUIEngineList engines[2]; ///< Left and right list of engines. bool replace_engines; ///< If \c true, engines are replaced, if \c false, wagons are replaced (only for trains). - bool reset_sel_engine; ///< Also reset #sel_engine while updating left and/or right (#update_left and/or #update_right) and no valid engine selected. + bool reset_sel_engine; ///< Also reset #sel_engine while updating left and/or right and no valid engine selected. GroupID sel_group; ///< Group selected to replace. int details_height; ///< Minimal needed height of the details panels (found so far). byte sort_criteria; ///< Criteria of sorting vehicles. diff --git a/src/blitter/32bpp_anim_sse4.cpp b/src/blitter/32bpp_anim_sse4.cpp index 9611cf09e7..259dc2b1c4 100644 --- a/src/blitter/32bpp_anim_sse4.cpp +++ b/src/blitter/32bpp_anim_sse4.cpp @@ -7,7 +7,7 @@ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . */ -/** @file 32bpp_sse4_anim.cpp Implementation of the SSE4 32 bpp blitter with animation support. */ +/** @file 32bpp_anim_sse4.cpp Implementation of the SSE4 32 bpp blitter with animation support. */ #ifdef WITH_SSE diff --git a/src/blitter/32bpp_anim_sse4.hpp b/src/blitter/32bpp_anim_sse4.hpp index 9d9ad5dd92..5ff1fb01be 100644 --- a/src/blitter/32bpp_anim_sse4.hpp +++ b/src/blitter/32bpp_anim_sse4.hpp @@ -7,7 +7,7 @@ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . */ -/** @file 32bpp_sse4_anim.hpp A SSE4 32 bpp blitter with animation support. */ +/** @file 32bpp_anim_sse4.hpp A SSE4 32 bpp blitter with animation support. */ #ifndef BLITTER_32BPP_SSE4_ANIM_HPP #define BLITTER_32BPP_SSE4_ANIM_HPP diff --git a/src/blitter/32bpp_sse_type.h b/src/blitter/32bpp_sse_type.h index b32d3c5abd..49c7a68c20 100644 --- a/src/blitter/32bpp_sse_type.h +++ b/src/blitter/32bpp_sse_type.h @@ -7,10 +7,10 @@ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . */ -/** @file 32bpp_sse_type.hpp Types related to SSE 32 bpp blitter. */ +/** @file 32bpp_sse_type.h Types related to SSE 32 bpp blitter. */ -#ifndef BLITTER_32BPP_SSE_TYPE_HPP -#define BLITTER_32BPP_SSE_TYPE_HPP +#ifndef BLITTER_32BPP_SSE_TYPE_H +#define BLITTER_32BPP_SSE_TYPE_H #ifdef WITH_SSE @@ -55,4 +55,4 @@ typedef union ALIGN(16) um128i { #define TRANSPARENT_NOM_BASE _mm_setr_epi16(256, 256, 256, 256, 256, 256, 256, 256) #endif /* WITH_SSE */ -#endif /* BLITTER_32BPP_SSE_TYPE_HPP */ +#endif /* BLITTER_32BPP_SSE_TYPE_H */ diff --git a/src/bridge_map.cpp b/src/bridge_map.cpp index 932782e3e9..00420aa2c8 100644 --- a/src/bridge_map.cpp +++ b/src/bridge_map.cpp @@ -58,7 +58,7 @@ TileIndex GetSouthernBridgeEnd(TileIndex t) /** * Starting at one bridge end finds the other bridge end - * @param t the bridge ramp tile to find the other bridge ramp for + * @param tile the bridge ramp tile to find the other bridge ramp for */ TileIndex GetOtherBridgeEnd(TileIndex tile) { @@ -68,7 +68,7 @@ TileIndex GetOtherBridgeEnd(TileIndex tile) /** * Get the height ('z') of a bridge. - * @param tile the bridge ramp tile to get the bridge height from + * @param t the bridge ramp tile to get the bridge height from * @return the height of the bridge. */ int GetBridgeHeight(TileIndex t) diff --git a/src/cargo_type.h b/src/cargo_type.h index 1eca0edff6..79d1c84f46 100644 --- a/src/cargo_type.h +++ b/src/cargo_type.h @@ -70,6 +70,11 @@ enum CargoType { CT_INVALID = 0xFF, ///< Invalid cargo type. }; +/** Test whether cargo type is not CT_INVALID */ +inline bool IsCargoTypeValid(CargoType t) { return t != CT_INVALID; } +/** Test whether cargo type is not CT_INVALID */ +inline bool IsCargoIDValid(CargoID t) { return t != CT_INVALID; } + typedef uint64 CargoTypes; static const CargoTypes ALL_CARGOTYPES = (CargoTypes)UINT64_MAX; diff --git a/src/cargopacket.cpp b/src/cargopacket.cpp index e892839761..5c3147e976 100644 --- a/src/cargopacket.cpp +++ b/src/cargopacket.cpp @@ -779,7 +779,7 @@ uint VehicleCargoList::Reassign static inline T ROL(const T x, const uint8 n) { + if (n == 0) return x; return (T)(x << n | x >> (sizeof(x) * 8 - n)); } @@ -345,6 +346,7 @@ static inline T ROL(const T x, const uint8 n) template static inline T ROR(const T x, const uint8 n) { + if (n == 0) return x; return (T)(x >> n | x << (sizeof(x) * 8 - n)); } diff --git a/src/core/smallmatrix_type.hpp b/src/core/smallmatrix_type.hpp index 9ebf0372c2..cd4dee4e3a 100644 --- a/src/core/smallmatrix_type.hpp +++ b/src/core/smallmatrix_type.hpp @@ -159,7 +159,7 @@ public: /** * Erase a row, replacing it with the last one. - * @param x Position of the row. + * @param y Position of the row. */ void EraseRow(uint y) { @@ -174,7 +174,7 @@ public: /** * Remove columns from the matrix while preserving the order of other columns. - * @param x First column to remove. + * @param y First column to remove. * @param count Number of consecutive columns to remove. */ void EraseRowPreservingOrder(uint y, uint count = 1) @@ -210,8 +210,8 @@ public: /** * Set the size to a specific width and height, preserving item positions * as far as possible in the process. - * @param width Target width. - * @param height Target height. + * @param new_width Target width. + * @param new_height Target height. */ inline void Resize(uint new_width, uint new_height) { @@ -297,7 +297,7 @@ public: /** * Get column "number" (const) * - * @param X Position of the column. + * @param x Position of the column. * @return Column at "number". */ inline const T *operator[](uint x) const @@ -309,7 +309,7 @@ public: /** * Get column "number" (const) * - * @param X Position of the column. + * @param x Position of the column. * @return Column at "number". */ inline T *operator[](uint x) diff --git a/src/depend/depend.cpp b/src/depend/depend.cpp index d4b102ddcf..f57acba25c 100644 --- a/src/depend/depend.cpp +++ b/src/depend/depend.cpp @@ -217,22 +217,22 @@ enum Token { TOKEN_LOCAL, ///< Read a local include TOKEN_GLOBAL, ///< Read a global include TOKEN_IDENTIFIER, ///< Identifier within the data. - TOKEN_DEFINE, ///< (#)define in code - TOKEN_IF, ///< (#)if in code - TOKEN_IFDEF, ///< (#)ifdef in code - TOKEN_IFNDEF, ///< (#)ifndef in code - TOKEN_ELIF, ///< (#)elif in code - TOKEN_ELSE, ///< (#)else in code - TOKEN_ENDIF, ///< (#)endif in code - TOKEN_UNDEF, ///< (#)undef in code - TOKEN_OR, ///< '||' within #if expression - TOKEN_AND, ///< '&&' within #if expression - TOKEN_DEFINED, ///< 'defined' within #if expression - TOKEN_OPEN, ///< '(' within #if expression - TOKEN_CLOSE, ///< ')' within #if expression - TOKEN_NOT, ///< '!' within #if expression - TOKEN_ZERO, ///< '0' within #if expression - TOKEN_INCLUDE, ///< (#)include in code + TOKEN_DEFINE, ///< \c \#define in code + TOKEN_IF, ///< \c \#if in code + TOKEN_IFDEF, ///< \c \#ifdef in code + TOKEN_IFNDEF, ///< \c \#ifndef in code + TOKEN_ELIF, ///< \c \#elif in code + TOKEN_ELSE, ///< \c \#else in code + TOKEN_ENDIF, ///< \c \#endif in code + TOKEN_UNDEF, ///< \c \#undef in code + TOKEN_OR, ///< '||' within \c \#if expression + TOKEN_AND, ///< '&&' within \c \#if expression + TOKEN_DEFINED, ///< 'defined' within \c \#if expression + TOKEN_OPEN, ///< '(' within \c \#if expression + TOKEN_CLOSE, ///< ')' within \c \#if expression + TOKEN_NOT, ///< '!' within \c \#if expression + TOKEN_ZERO, ///< '0' within \c \#if expression + TOKEN_INCLUDE, ///< \c \#include in code }; /** Mapping from a C-style keyword representation to a Token. */ @@ -681,8 +681,8 @@ bool ExpressionOr(Lexer *lexer, StringSet *defines, bool verbose) /** Enumerator to tell how long to ignore 'stuff'. */ enum Ignore { NOT_IGNORE, ///< No ignoring. - IGNORE_UNTIL_ELSE, ///< Ignore till a #else is reached. - IGNORE_UNTIL_ENDIF, ///< Ignore till a #endif is reached. + IGNORE_UNTIL_ELSE, ///< Ignore till a \c \#else is reached. + IGNORE_UNTIL_ENDIF, ///< Ignore till a \c \#endif is reached. }; /** diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index cc03f53e4c..407f7d2308 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -910,9 +910,16 @@ struct DepotWindow : Window { */ virtual bool OnVehicleSelect(const Vehicle *v) { - if (DoCommandP(this->window_number, v->index, _ctrl_pressed ? 1 : 0, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), CcCloneVehicle)) { - ResetObjectToPlace(); + if (_ctrl_pressed) { + /* Share-clone, do not open new viewport, and keep tool active */ + DoCommandP(this->window_number, v->index, 1, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), NULL); + } else { + /* Copy-clone, open viewport for new vehicle, and deselect the tool (assume player wants to changs things on new vehicle) */ + if (DoCommandP(this->window_number, v->index, 0, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), CcCloneVehicle)) { + ResetObjectToPlace(); + } } + return true; } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 62dae8d3e4..a66e2f6d96 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -56,8 +56,8 @@ void CcPlaySound_SPLAT_WATER(const CommandCost &result, TileIndex tile, uint32 p /** * Gets the other end of the aqueduct, if possible. - * @param tile_from The begin tile for the aqueduct. - * @param [out] tile_to The tile till where to show a selection for the aqueduct. + * @param tile_from The begin tile for the aqueduct. + * @param[out] tile_to The tile till where to show a selection for the aqueduct. * @return The other end of the aqueduct, or otherwise a tile in line with the aqueduct to cause the right error message. */ static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = NULL) diff --git a/src/economy.cpp b/src/economy.cpp index d72a7943bc..6e80495aea 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1094,6 +1094,7 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n uint amount = min(num_pieces, 0xFFFFU - ind->incoming_cargo_waiting[cargo_index]); ind->incoming_cargo_waiting[cargo_index] += amount; + ind->last_cargo_accepted_at[cargo_index] = _date; num_pieces -= amount; accepted += amount; } @@ -1170,7 +1171,6 @@ static void TriggerIndustryProduction(Industry *i) uint16 callback = indspec->callback_mask; i->was_cargo_delivered = true; - i->last_cargo_accepted_at = _date; if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(callback, CBM_IND_PRODUCTION_256_TICKS)) { if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) { @@ -1179,14 +1179,15 @@ static void TriggerIndustryProduction(Industry *i) SetWindowDirty(WC_INDUSTRY_VIEW, i->index); } } else { - for (uint cargo_index = 0; cargo_index < lengthof(i->incoming_cargo_waiting); cargo_index++) { - uint cargo_waiting = i->incoming_cargo_waiting[cargo_index]; + for (uint ci_in = 0; ci_in < lengthof(i->incoming_cargo_waiting); ci_in++) { + uint cargo_waiting = i->incoming_cargo_waiting[ci_in]; if (cargo_waiting == 0) continue; - i->produced_cargo_waiting[0] = min(i->produced_cargo_waiting[0] + (cargo_waiting * indspec->input_cargo_multiplier[cargo_index][0] / 256), 0xFFFF); - i->produced_cargo_waiting[1] = min(i->produced_cargo_waiting[1] + (cargo_waiting * indspec->input_cargo_multiplier[cargo_index][1] / 256), 0xFFFF); + for (uint ci_out = 0; ci_out < lengthof(i->produced_cargo_waiting); ci_out++) { + i->produced_cargo_waiting[ci_out] = min(i->produced_cargo_waiting[ci_out] + (cargo_waiting * indspec->input_cargo_multiplier[ci_in][ci_out] / 256), 0xFFFF); + } - i->incoming_cargo_waiting[cargo_index] = 0; + i->incoming_cargo_waiting[ci_in] = 0; } } @@ -1308,7 +1309,6 @@ static OrderUnloadFlags GetUnloadType(const Vehicle *v) /** * Prepare the vehicle to be unloaded. - * @param curr_station the station where the consist is at the moment * @param front_v the vehicle to be unloaded */ void PrepareUnload(Vehicle *front_v) diff --git a/src/engine.cpp b/src/engine.cpp index 0bb62b0f85..b54d3f8b4b 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -583,7 +583,7 @@ static bool IsWagon(EngineID index) } /** - * Update #reliability of engine \a e, (if needed) update the engine GUIs. + * Update #Engine::reliability and (if needed) update the engine GUIs. * @param e %Engine to update. */ static void CalcEngineReliability(Engine *e) diff --git a/src/error_gui.cpp b/src/error_gui.cpp index c8c603afb3..1c59b7e8d0 100644 --- a/src/error_gui.cpp +++ b/src/error_gui.cpp @@ -425,7 +425,7 @@ void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel /** * Schedule a list of errors. * Note: This does not try to display the error now. This is useful if the window system is not yet running. - * @param data Error message datas; cleared afterwards + * @param datas Error message datas; cleared afterwards */ void ScheduleErrorMessage(ErrorList &datas) { diff --git a/src/fileio.cpp b/src/fileio.cpp index d31e814015..31f84e9d14 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -347,7 +347,7 @@ char *FioGetFullPath(char *buf, const char *last, Searchpath sp, Subdirectory su /** * Find a path to the filename in one of the search directories. - * @param buf [out] Destination buffer for the path. + * @param[out] buf Destination buffer for the path. * @param last End of the destination buffer. * @param subdir Subdirectory to try. * @param filename Filename to look for. @@ -438,7 +438,7 @@ static FILE *FioFOpenFileSp(const char *filename, const char *mode, Searchpath s /** * Opens a file from inside a tar archive. * @param entry The entry to open. - * @param filesize [out] If not \c NULL, size of the opened file. + * @param[out] filesize If not \c NULL, size of the opened file. * @return File handle of the opened file, or \c NULL if the file is not available. * @note The file is read from within the tar file, and may not return \c EOF after reading the whole file. */ @@ -460,7 +460,6 @@ FILE *FioFOpenFileTar(TarFileListEntry *entry, size_t *filesize) * Opens a OpenTTD file somewhere in a personal or global directory. * @param filename Name of the file to open. * @param subdir Subdirectory to open. - * @param filename Name of the file to open. * @return File handle of the opened file, or \c NULL if the file is not available. */ FILE *FioFOpenFile(const char *filename, const char *mode, Subdirectory subdir, size_t *filesize) @@ -632,7 +631,7 @@ static void SimplifyFileName(char *name) /** * Perform the scanning of a particular subdirectory. - * @param subdir The subdirectory to scan. + * @param sd The subdirectory to scan. * @return The number of found tar files. */ uint TarScanner::DoScan(Subdirectory sd) @@ -1303,7 +1302,7 @@ void SanitizeFilename(char *filename) /** * Load a file into memory. * @param filename Name of the file to load. - * @param lenp [out] Length of loaded data. + * @param[out] lenp Length of loaded data. * @param maxsize Maximum size to load. * @return Pointer to new memory containing the loaded data, or \c NULL if loading failed. * @note If \a maxsize less than the length of the file, loading fails. diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp index f20cfd7927..9aa5277acf 100644 --- a/src/fios_gui.cpp +++ b/src/fios_gui.cpp @@ -201,7 +201,7 @@ static const TextColour _fios_colours[] = { /** * Sort the collected list save games prior to displaying it in the save/load gui. - * @param [inout] file_list List of save game files found in the directory. + * @param[in,out] file_list List of save game files found in the directory. */ static void SortSaveGameList(FileList &file_list) { diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp index 42ced20083..a32e5b41d7 100644 --- a/src/game/game_text.cpp +++ b/src/game/game_text.cpp @@ -142,7 +142,7 @@ struct StringListReader : StringReader { /** * Create the reader. * @param data The data to fill during reading. - * @param file The file we are reading. + * @param strings The language strings we are reading. * @param master Are we reading the master file? * @param translation Are we reading a translation? */ diff --git a/src/gamelog.cpp b/src/gamelog.cpp index 940d9a8247..094460226c 100644 --- a/src/gamelog.cpp +++ b/src/gamelog.cpp @@ -771,9 +771,9 @@ void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc) * Get some basic information from the given gamelog. * @param gamelog_action Pointer to the gamelog to extract information from. * @param gamelog_actions Number of actions in the given gamelog. - * @param [out] last_ottd_rev OpenTTD NewGRF version from the binary that saved the savegame last. - * @param [out] ever_modified Max value of 'modified' from all binaries that ever saved this savegame. - * @param [out] removed_newgrfs Set to true if any NewGRFs have been removed. + * @param[out] last_ottd_rev OpenTTD NewGRF version from the binary that saved the savegame last. + * @param[out] ever_modified Max value of 'modified' from all binaries that ever saved this savegame. + * @param[out] removed_newgrfs Set to true if any NewGRFs have been removed. */ void GamelogInfo(LoggedAction *gamelog_action, uint gamelog_actions, uint32 *last_ottd_rev, byte *ever_modified, bool *removed_newgrfs) { diff --git a/src/gfx.cpp b/src/gfx.cpp index 2af17d3bc2..5826916965 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -703,8 +703,8 @@ Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize) } /** - * Get bounding box of a string. Uses parameters set by #DParam if needed. - * Has the same restrictions as #GetStringBoundingBox(const char *str). + * Get bounding box of a string. Uses parameters set by #SetDParam if needed. + * Has the same restrictions as #GetStringBoundingBox(const char *str, FontSize start_fontsize). * @param strid String to examine. * @return Width and height of the bounding box for the string in pixels. */ @@ -761,7 +761,7 @@ void DrawCharCentered(WChar c, int x, int y, TextColour colour) /** * Get the size of a sprite. * @param sprid Sprite to examine. - * @param [out] offset Optionally returns the sprite position offset. + * @param[out] offset Optionally returns the sprite position offset. * @return Sprite size in pixels. * @note The size assumes (0, 0) as top-left coordinate and ignores any part of the sprite drawn at the left or above that position. */ @@ -1170,8 +1170,8 @@ byte GetDigitWidth(FontSize size) /** * Determine the broadest digits for guessing the maximum width of a n-digit number. - * @param [out] front Broadest digit, which is not 0. (Use this digit as first digit for numbers with more than one digit.) - * @param [out] next Broadest digit, including 0. (Use this digit for all digits, except the first one; or for numbers with only one digit.) + * @param[out] front Broadest digit, which is not 0. (Use this digit as first digit for numbers with more than one digit.) + * @param[out] next Broadest digit, including 0. (Use this digit for all digits, except the first one; or for numbers with only one digit.) * @param size Font of the digit */ void GetBroadestDigit(uint *front, uint *next, FontSize size) @@ -1638,8 +1638,8 @@ void SetAnimatedMouseCursor(const AnimCursor *table) * Update cursor position on mouse movement. * @param x New X position. * @param y New Y position. - * @param queued True, if the OS queues mouse warps after pending mouse movement events. - * False, if the warp applies instantaneous. + * @param queued_warp True, if the OS queues mouse warps after pending mouse movement events. + * False, if the warp applies instantaneous. * @return true, if the OS cursor position should be warped back to this->pos. */ bool CursorVars::UpdateCursorPosition(int x, int y, bool queued_warp) diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp index 6cef84e13f..c493e69c35 100644 --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -498,11 +498,6 @@ const ParagraphLayouter::Line *FallbackParagraphLayout::NextLine(int max_width) return l; } - const WChar *begin = this->buffer; - const WChar *last_space = NULL; - const WChar *last_char = begin; - int width = 0; - int offset = this->buffer - this->buffer_begin; FontMap::iterator iter = this->runs.Begin(); while (iter->first <= offset) { @@ -513,6 +508,10 @@ const ParagraphLayouter::Line *FallbackParagraphLayout::NextLine(int max_width) const FontCache *fc = iter->second->fc; const WChar *next_run = this->buffer_begin + iter->first; + const WChar *begin = this->buffer; + const WChar *last_space = NULL; + const WChar *last_char; + int width = 0; for (;;) { WChar c = *this->buffer; last_char = this->buffer; diff --git a/src/gfx_type.h b/src/gfx_type.h index ca9bf9fcef..4cfc149a86 100644 --- a/src/gfx_type.h +++ b/src/gfx_type.h @@ -189,7 +189,7 @@ union Colour { /** * Create a new colour. - * @param The colour in the correct packed format. + * @param data The colour in the correct packed format. */ Colour(uint data = 0) : data(data) { diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index ea51c990dc..39f735edaf 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -91,7 +91,7 @@ static uint LoadGrfFile(const char *filename, uint load_index, int file_index) /** * Load an old fashioned GRF file to replace already loaded sprites. * @param filename The name of the file to open. - * @param index_tlb The offsets of each of the sprites. + * @param index_tbl The offsets of each of the sprites. * @param file_index The Fio offset to load the file in. * @return The number of loaded sprites. */ diff --git a/src/goal_gui.cpp b/src/goal_gui.cpp index f98189d183..ee4d8170e1 100644 --- a/src/goal_gui.cpp +++ b/src/goal_gui.cpp @@ -101,7 +101,7 @@ struct GoalListWindow : public Window { /** * Handle clicking at a goal. - * @param s @Goal clicked at. + * @param s #Goal clicked at. */ void HandleClick(const Goal *s) { @@ -193,7 +193,7 @@ struct GoalListWindow : public Window { /** * Draws either the global goals or the company goal section. * This is a helper method for #DrawWidget. - * @param pos [inout] Vertical line number to draw. + * @param[in,out] pos Vertical line number to draw. * @param cap Number of lines to draw in the window. * @param x Left edge of the text line to draw. * @param y Vertical position of the top edge of the window. @@ -250,8 +250,8 @@ struct GoalListWindow : public Window { /** * Draws a given column of the goal list. * @param column Which column to draw. - * @wid Pointer to the goal list widget. - * @progress_col_width Width of the progress column. + * @param wid Pointer to the goal list widget. + * @param progress_col_width Width of the progress column. * @return max width of drawn text */ void DrawListColumn(GoalColumn column, NWidgetBase *wid, uint progress_col_width) const diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp index 3a31b85edf..d2ceffb5ed 100644 --- a/src/group_cmd.cpp +++ b/src/group_cmd.cpp @@ -100,7 +100,7 @@ void GroupStatistics::Clear() } /** - * Update all caches after loading a game, changing NewGRF etc.. + * Update all caches after loading a game, changing NewGRF, etc. */ /* static */ void GroupStatistics::UpdateAfterLoad() { diff --git a/src/group_gui.cpp b/src/group_gui.cpp index e59781e5cc..e11f5d703b 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -1116,11 +1116,11 @@ static inline VehicleGroupWindow *FindVehicleGroupWindow(VehicleType vt, Owner o } /** - * Opens a 'Rename group' window for newly created group - * @param success did command succeed? - * @param tile unused - * @param p1 vehicle type - * @param p2 unused + * Opens a 'Rename group' window for newly created group. + * @param result Did command succeed? + * @param tile Unused. + * @param p1 Vehicle type. + * @param p2 Unused. * @see CmdCreateGroup */ void CcCreateGroup(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2) @@ -1134,7 +1134,7 @@ void CcCreateGroup(const CommandCost &result, TileIndex tile, uint32 p1, uint32 /** * Open rename window after adding a vehicle to a new group via drag and drop. - * @param success Did command succeed? + * @param result Did command succeed? * @param tile Unused. * @param p1 Unused. * @param p2 Bit 0-19: Vehicle ID. diff --git a/src/heightmap.cpp b/src/heightmap.cpp index 630dc69d7e..17bdbbf610 100644 --- a/src/heightmap.cpp +++ b/src/heightmap.cpp @@ -447,9 +447,9 @@ void FixSlopes() * Reads the heightmap with the correct file reader. * @param dft Type of image file. * @param filename Name of the file to load. - * @param [out] x Length of the image. - * @param [out] y Height of the image. - * @param [inout] map If not \c NULL, destination to store the loaded block of image data. + * @param[out] x Length of the image. + * @param[out] y Height of the image. + * @param[in,out] map If not \c NULL, destination to store the loaded block of image data. * @return Whether loading was successful. */ static bool ReadHeightMap(DetailedFileType dft, const char *filename, uint *x, uint *y, byte **map) diff --git a/src/industry.h b/src/industry.h index 9b185efc4b..af0208b3cc 100644 --- a/src/industry.h +++ b/src/industry.h @@ -12,9 +12,11 @@ #ifndef INDUSTRY_H #define INDUSTRY_H +#include #include "newgrf_storage.h" #include "subsidy_type.h" #include "industry_map.h" +#include "industrytype.h" #include "tilearea_type.h" @@ -37,20 +39,20 @@ enum ProductionLevels { * Defines the internal data of a functional industry. */ struct Industry : IndustryPool::PoolItem<&_industry_pool> { - TileArea location; ///< Location of the industry - Town *town; ///< Nearest town - CargoID produced_cargo[2]; ///< 2 production cargo slots - uint16 produced_cargo_waiting[2]; ///< amount of cargo produced per cargo - uint16 incoming_cargo_waiting[3]; ///< incoming cargo waiting to be processed - byte production_rate[2]; ///< production rate for each cargo - byte prod_level; ///< general production level - CargoID accepts_cargo[3]; ///< 3 input cargo slots - uint16 this_month_production[2]; ///< stats of this month's production per cargo - uint16 this_month_transported[2]; ///< stats of this month's transport per cargo - byte last_month_pct_transported[2]; ///< percentage transported per cargo in the last full month - uint16 last_month_production[2]; ///< total units produced per cargo in the last full month - uint16 last_month_transported[2]; ///< total units transported per cargo in the last full month - uint16 counter; ///< used for animation and/or production (if available cargo) + TileArea location; ///< Location of the industry + Town *town; ///< Nearest town + CargoID produced_cargo[INDUSTRY_NUM_OUTPUTS]; ///< 16 production cargo slots + uint16 produced_cargo_waiting[INDUSTRY_NUM_OUTPUTS]; ///< amount of cargo produced per cargo + uint16 incoming_cargo_waiting[INDUSTRY_NUM_INPUTS]; ///< incoming cargo waiting to be processed + byte production_rate[INDUSTRY_NUM_OUTPUTS]; ///< production rate for each cargo + byte prod_level; ///< general production level + CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]; ///< 16 input cargo slots + uint16 this_month_production[INDUSTRY_NUM_OUTPUTS]; ///< stats of this month's production per cargo + uint16 this_month_transported[INDUSTRY_NUM_OUTPUTS]; ///< stats of this month's transport per cargo + byte last_month_pct_transported[INDUSTRY_NUM_OUTPUTS]; ///< percentage transported per cargo in the last full month + uint16 last_month_production[INDUSTRY_NUM_OUTPUTS]; ///< total units produced per cargo in the last full month + uint16 last_month_transported[INDUSTRY_NUM_OUTPUTS]; ///< total units transported per cargo in the last full month + uint16 counter; ///< used for animation and/or production (if available cargo) IndustryType type; ///< type of industry. OwnerByte owner; ///< owner of the industry. Which SHOULD always be (imho) OWNER_NONE @@ -63,7 +65,7 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> { OwnerByte founder; ///< Founder of the industry Date construction_date; ///< Date of the construction of the industry uint8 construction_type; ///< Way the industry was constructed (@see IndustryConstructionType) - Date last_cargo_accepted_at; ///< Last day cargo was accepted by this industry + Date last_cargo_accepted_at[INDUSTRY_NUM_INPUTS]; ///< Last day each cargo type was accepted by this industry byte selected_layout; ///< Which tile layout was used when creating the industry uint16 random; ///< Random value used for randomisation of all kinds of things @@ -85,6 +87,22 @@ struct Industry : IndustryPool::PoolItem<&_industry_pool> { return IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == this->index; } + inline int GetCargoProducedIndex(CargoID cargo) const + { + if (cargo == CT_INVALID) return -1; + const CargoID *pos = std::find(this->produced_cargo, endof(this->produced_cargo), cargo); + if (pos == endof(this->produced_cargo)) return -1; + return pos - this->produced_cargo; + } + + inline int GetCargoAcceptedIndex(CargoID cargo) const + { + if (cargo == CT_INVALID) return -1; + const CargoID *pos = std::find(this->accepts_cargo, endof(this->accepts_cargo), cargo); + if (pos == endof(this->accepts_cargo)) return -1; + return pos - this->accepts_cargo; + } + /** * Get the industry of the given tile * @param tile the tile to get the industry from diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 54a96fce9a..36e67d0984 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -395,35 +395,49 @@ static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, Ca { IndustryGfx gfx = GetIndustryGfx(tile); const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx); + const Industry *ind = Industry::GetByTile(tile); - /* When we have to use a callback, we put our data in the next two variables */ - CargoID raw_accepts_cargo[lengthof(itspec->accepts_cargo)]; - uint8 raw_cargo_acceptance[lengthof(itspec->acceptance)]; + /* Starting point for acceptance */ + CargoID accepts_cargo[lengthof(itspec->accepts_cargo)]; + int8 cargo_acceptance[lengthof(itspec->acceptance)]; + MemCpyT(accepts_cargo, itspec->accepts_cargo, lengthof(accepts_cargo)); + MemCpyT(cargo_acceptance, itspec->acceptance, lengthof(cargo_acceptance)); - /* And then these will always point to a same sized array with the required data */ - const CargoID *accepts_cargo = itspec->accepts_cargo; - const uint8 *cargo_acceptance = itspec->acceptance; + if (itspec->special_flags & INDTILE_SPECIAL_ACCEPTS_ALL_CARGO) { + /* Copy all accepted cargoes from industry itself */ + for (uint i = 0; i < lengthof(ind->accepts_cargo); i++) { + CargoID *pos = std::find(accepts_cargo, endof(accepts_cargo), ind->accepts_cargo[i]); + if (pos == endof(accepts_cargo)) { + /* Not found, insert */ + pos = std::find(accepts_cargo, endof(accepts_cargo), CT_INVALID); + if (pos == endof(accepts_cargo)) continue; // nowhere to place, give up on this one + *pos = ind->accepts_cargo[i]; + } + cargo_acceptance[pos - accepts_cargo] += 8; + } + } if (HasBit(itspec->callback_mask, CBM_INDT_ACCEPT_CARGO)) { + /* Try callback for accepts list, if success override all existing accepts */ uint16 res = GetIndustryTileCallback(CBID_INDTILE_ACCEPT_CARGO, 0, 0, gfx, Industry::GetByTile(tile), tile); if (res != CALLBACK_FAILED) { - accepts_cargo = raw_accepts_cargo; - for (uint i = 0; i < lengthof(itspec->accepts_cargo); i++) raw_accepts_cargo[i] = GetCargoTranslation(GB(res, i * 5, 5), itspec->grf_prop.grffile); + MemSetT(accepts_cargo, CT_INVALID, lengthof(accepts_cargo)); + for (uint i = 0; i < 3; i++) accepts_cargo[i] = GetCargoTranslation(GB(res, i * 5, 5), itspec->grf_prop.grffile); } } if (HasBit(itspec->callback_mask, CBM_INDT_CARGO_ACCEPTANCE)) { + /* Try callback for acceptance list, if success override all existing acceptance */ uint16 res = GetIndustryTileCallback(CBID_INDTILE_CARGO_ACCEPTANCE, 0, 0, gfx, Industry::GetByTile(tile), tile); if (res != CALLBACK_FAILED) { - cargo_acceptance = raw_cargo_acceptance; - for (uint i = 0; i < lengthof(itspec->accepts_cargo); i++) raw_cargo_acceptance[i] = GB(res, i * 4, 4); + MemSetT(cargo_acceptance, 0, lengthof(cargo_acceptance)); + for (uint i = 0; i < 3; i++) cargo_acceptance[i] = GB(res, i * 4, 4); } } - const Industry *ind = Industry::GetByTile(tile); for (byte i = 0; i < lengthof(itspec->accepts_cargo); i++) { CargoID a = accepts_cargo[i]; - if (a == CT_INVALID || cargo_acceptance[i] == 0) continue; // work only with valid cargoes + if (a == CT_INVALID || cargo_acceptance[i] <= 0) continue; // work only with valid cargoes /* Add accepted cargo */ acceptance[a] += cargo_acceptance[i]; @@ -1119,8 +1133,9 @@ static void ProduceIndustryGoods(Industry *i) if (HasBit(indsp->callback_mask, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1); IndustryBehaviour indbehav = indsp->behaviour; - i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + i->production_rate[0]); - i->produced_cargo_waiting[1] = min(0xffff, i->produced_cargo_waiting[1] + i->production_rate[1]); + for (size_t j = 0; j < lengthof(i->produced_cargo_waiting); j++) { + i->produced_cargo_waiting[j] = min(0xffff, i->produced_cargo_waiting[j] + i->production_rate[j]); + } if ((indbehav & INDUSTRYBEH_PLANT_FIELDS) != 0) { uint16 cb_res = CALLBACK_FAILED; @@ -1324,7 +1339,7 @@ static CheckNewIndustryProc * const _check_new_industry_procs[CHECK_END] = { * Find a town for the industry, while checking for multiple industries in the same town. * @param tile Position of the industry to build. * @param type Industry type. - * @param [out] town Pointer to return town for the new industry, \c NULL is written if no good town can be found. + * @param[out] t Pointer to return town for the new industry, \c NULL is written if no good town can be found. * @return Succeeded or failed command. * * @pre \c *t != NULL @@ -1366,14 +1381,14 @@ bool IsSlopeRefused(Slope current, Slope refused) /** * Are the tiles of the industry free? - * @param tile Position to check. - * @param it Industry tiles table. - * @param itspec_index The index of the itsepc to build/fund - * @param type Type of the industry. - * @param initial_random_bits The random bits the industry is going to have after construction. - * @param founder Industry founder - * @param creation_type The circumstances the industry is created under. - * @param [out] custom_shape_check Perform custom check for the site. + * @param tile Position to check. + * @param it Industry tiles table. + * @param itspec_index The index of the itsepc to build/fund + * @param type Type of the industry. + * @param initial_random_bits The random bits the industry is going to have after construction. + * @param founder Industry founder + * @param creation_type The circumstances the industry is created under. + * @param[out] custom_shape_check Perform custom check for the site. * @return Failed or succeeded command. */ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable *it, uint itspec_index, int type, uint16 initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type, bool *custom_shape_check = NULL) @@ -1656,18 +1671,23 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, i->type = type; Industry::IncIndustryTypeCount(type); - i->produced_cargo[0] = indspec->produced_cargo[0]; - i->produced_cargo[1] = indspec->produced_cargo[1]; - i->accepts_cargo[0] = indspec->accepts_cargo[0]; - i->accepts_cargo[1] = indspec->accepts_cargo[1]; - i->accepts_cargo[2] = indspec->accepts_cargo[2]; - i->production_rate[0] = indspec->production_rate[0]; - i->production_rate[1] = indspec->production_rate[1]; + MemCpyT(i->produced_cargo, indspec->produced_cargo, lengthof(i->produced_cargo)); + MemCpyT(i->production_rate, indspec->production_rate, lengthof(i->production_rate)); + MemCpyT(i->accepts_cargo, indspec->accepts_cargo, lengthof(i->accepts_cargo)); + + MemSetT(i->produced_cargo_waiting, 0, lengthof(i->produced_cargo_waiting)); + MemSetT(i->this_month_production, 0, lengthof(i->this_month_production)); + MemSetT(i->this_month_transported, 0, lengthof(i->this_month_transported)); + MemSetT(i->last_month_pct_transported, 0, lengthof(i->last_month_pct_transported)); + MemSetT(i->last_month_transported, 0, lengthof(i->last_month_transported)); + MemSetT(i->incoming_cargo_waiting, 0, lengthof(i->incoming_cargo_waiting)); + MemSetT(i->last_cargo_accepted_at, 0, lengthof(i->last_cargo_accepted_at)); /* don't use smooth economy for industries using production related callbacks */ if (indspec->UsesSmoothEconomy()) { - i->production_rate[0] = min((RandomRange(256) + 128) * i->production_rate[0] >> 8, 255); - i->production_rate[1] = min((RandomRange(256) + 128) * i->production_rate[1] >> 8, 255); + for (size_t ci = 0; ci < lengthof(i->production_rate); ci++) { + i->production_rate[ci] = min((RandomRange(256) + 128) * i->production_rate[ci] >> 8, 255); + } } i->town = t; @@ -1677,19 +1697,6 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, i->random_colour = GB(r, 0, 4); i->counter = GB(r, 4, 12); i->random = initial_random_bits; - i->produced_cargo_waiting[0] = 0; - i->produced_cargo_waiting[1] = 0; - i->incoming_cargo_waiting[0] = 0; - i->incoming_cargo_waiting[1] = 0; - i->incoming_cargo_waiting[2] = 0; - i->this_month_production[0] = 0; - i->this_month_production[1] = 0; - i->this_month_transported[0] = 0; - i->this_month_transported[1] = 0; - i->last_month_pct_transported[0] = 0; - i->last_month_pct_transported[1] = 0; - i->last_month_transported[0] = 0; - i->last_month_transported[1] = 0; i->was_cargo_delivered = false; i->last_prod_year = _cur_year; i->founder = founder; @@ -1720,10 +1727,9 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, } if (_generating_world) { - i->last_month_production[0] = i->production_rate[0] * 8; - i->last_month_production[1] = i->production_rate[1] * 8; - } else { - i->last_month_production[0] = i->last_month_production[1] = 0; + for (size_t ci = 0; ci < lengthof(i->last_month_production); ci++) { + i->last_month_production[ci] = i->production_rate[ci] * 8; + } } if (HasBit(indspec->callback_mask, CBM_IND_DECIDE_COLOUR)) { @@ -1735,28 +1741,56 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, } if (HasBit(indspec->callback_mask, CBM_IND_INPUT_CARGO_TYPES)) { + /* Clear all input cargo types */ for (uint j = 0; j < lengthof(i->accepts_cargo); j++) i->accepts_cargo[j] = CT_INVALID; - for (uint j = 0; j < lengthof(i->accepts_cargo); j++) { + /* Query actual types */ + uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? lengthof(i->accepts_cargo) : 3; + for (uint j = 0; j < maxcargoes; j++) { uint16 res = GetIndustryCallback(CBID_INDUSTRY_INPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE); if (res == CALLBACK_FAILED || GB(res, 0, 8) == CT_INVALID) break; if (indspec->grf_prop.grffile->grf_version >= 8 && res >= 0x100) { ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_INPUT_CARGO_TYPES, res); break; } - i->accepts_cargo[j] = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile); + CargoID cargo = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile); + if (std::find(indspec->accepts_cargo, endof(indspec->accepts_cargo), cargo) == endof(indspec->accepts_cargo)) { + /* Cargo not in spec, error in NewGRF */ + ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_INPUT_CARGO_TYPES, res); + break; + } + if (std::find(i->accepts_cargo, i->accepts_cargo + j, cargo) != i->accepts_cargo + j) { + /* Duplicate cargo */ + ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_INPUT_CARGO_TYPES, res); + break; + } + i->accepts_cargo[j] = cargo; } } if (HasBit(indspec->callback_mask, CBM_IND_OUTPUT_CARGO_TYPES)) { + /* Clear all output cargo types */ for (uint j = 0; j < lengthof(i->produced_cargo); j++) i->produced_cargo[j] = CT_INVALID; - for (uint j = 0; j < lengthof(i->produced_cargo); j++) { + /* Query actual types */ + uint maxcargoes = (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) ? lengthof(i->produced_cargo) : 2; + for (uint j = 0; j < maxcargoes; j++) { uint16 res = GetIndustryCallback(CBID_INDUSTRY_OUTPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE); if (res == CALLBACK_FAILED || GB(res, 0, 8) == CT_INVALID) break; if (indspec->grf_prop.grffile->grf_version >= 8 && res >= 0x100) { ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_OUTPUT_CARGO_TYPES, res); break; } - i->produced_cargo[j] = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile); + CargoID cargo = GetCargoTranslation(GB(res, 0, 8), indspec->grf_prop.grffile); + if (std::find(indspec->produced_cargo, endof(indspec->produced_cargo), cargo) == endof(indspec->produced_cargo)) { + /* Cargo not in spec, error in NewGRF */ + ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_OUTPUT_CARGO_TYPES, res); + break; + } + if (std::find(i->produced_cargo, i->produced_cargo + j, cargo) != i->produced_cargo + j) { + /* Duplicate cargo */ + ErrorUnknownCallbackResult(indspec->grf_prop.grffile->grfid, CBID_INDUSTRY_OUTPUT_CARGO_TYPES, res); + break; + } + i->produced_cargo[j] = cargo; } } @@ -1801,11 +1835,11 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, IndustryType type, * @param flags of operations to conduct * @param indspec pointer to industry specifications * @param itspec_index the index of the itsepc to build/fund - * @param seed random seed (possibly) used by industries - * @param initial_random_bits The random bits the industry is going to have after construction. + * @param random_var8f random seed (possibly) used by industries + * @param random_initial_bits The random bits the industry is going to have after construction. * @param founder Founder of the industry * @param creation_type The circumstances the industry is created under. - * @param [out] ip Pointer to store newly created industry. + * @param[out] ip Pointer to store newly created industry. * @return Succeeded or failed command. * * @post \c *ip contains the newly created industry if all checks are successful and the \a flags request actual creation, else it contains \c NULL afterwards. @@ -1969,7 +2003,7 @@ static Industry *CreateNewIndustry(TileIndex tile, IndustryType type, IndustryAv /** * Compute the appearance probability for an industry during map creation. * @param it Industry type to compute. - * @param [out] force_at_least_one Returns whether at least one instance should be forced on map creation. + * @param[out] force_at_least_one Returns whether at least one instance should be forced on map creation. * @return Relative probability for the industry to appear. */ static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *force_at_least_one) @@ -1994,7 +2028,7 @@ static uint32 GetScaledIndustryGenerationProbability(IndustryType it, bool *forc /** * Compute the probability for constructing a new industry during game play. * @param it Industry type to compute. - * @param [out] min_number Minimal number of industries that should exist at the map. + * @param[out] min_number Minimal number of industries that should exist at the map. * @return Relative probability for the industry to appear. */ static uint16 GetIndustryGamePlayProbability(IndustryType it, byte *min_number) @@ -2202,8 +2236,9 @@ void Industry::RecomputeProductionMultipliers() assert(!indspec->UsesSmoothEconomy()); /* Rates are rounded up, so e.g. oilrig always produces some passengers */ - this->production_rate[0] = min(CeilDiv(indspec->production_rate[0] * this->prod_level, PRODLEVEL_DEFAULT), 0xFF); - this->production_rate[1] = min(CeilDiv(indspec->production_rate[1] * this->prod_level, PRODLEVEL_DEFAULT), 0xFF); + for (size_t i = 0; i < lengthof(this->production_rate); i++) { + this->production_rate[i] = min(CeilDiv(indspec->production_rate[i] * this->prod_level, PRODLEVEL_DEFAULT), 0xFF); + } } diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp index 1e59f44930..3097834e6a 100644 --- a/src/industry_gui.cpp +++ b/src/industry_gui.cpp @@ -74,12 +74,7 @@ static void ShowIndustryCargoesWindow(IndustryType id); /** * Gets the string to display after the cargo name (using callback 37) - * @param cargo the cargo for which the suffix is requested - * - 00 - first accepted cargo type - * - 01 - second accepted cargo type - * - 02 - third accepted cargo type - * - 03 - first produced cargo type - * - 04 - second produced cargo type + * @param cargo the cargo for which the suffix is requested, meaning depends on presence of flag 18 in prop 1A * @param cst the cargo suffix type (for which window is it requested). @see CargoSuffixType * @param ind the industry (NULL if in fund window) * @param ind_type the industry type @@ -134,9 +129,14 @@ static void GetCargoSuffix(uint cargo, CargoSuffixType cst, const Industry *ind, } } +enum CargoSuffixInOut { + CARGOSUFFIX_OUT = 0, + CARGOSUFFIX_IN = 1, +}; + /** * Gets all strings to display after the cargoes of industries (using callback 37) - * @param cb_offset The offset for the cargo used in cb37, 0 for accepted cargoes, 3 for produced cargoes + * @param use_input get suffixes for output cargoes or input cargoes? * @param cst the cargo suffix type (for which window is it requested). @see CargoSuffixType * @param ind the industry (NULL if in fund window) * @param ind_type the industry type @@ -145,14 +145,40 @@ static void GetCargoSuffix(uint cargo, CargoSuffixType cst, const Industry *ind, * @param suffixes is filled with the suffixes */ template -static inline void GetAllCargoSuffixes(uint cb_offset, CargoSuffixType cst, const Industry *ind, IndustryType ind_type, const IndustrySpec *indspec, const TC &cargoes, TS &suffixes) +static inline void GetAllCargoSuffixes(CargoSuffixInOut use_input, CargoSuffixType cst, const Industry *ind, IndustryType ind_type, const IndustrySpec *indspec, const TC &cargoes, TS &suffixes) { assert_compile(lengthof(cargoes) <= lengthof(suffixes)); - for (uint j = 0; j < lengthof(cargoes); j++) { - if (cargoes[j] != CT_INVALID) { - GetCargoSuffix(cb_offset + j, cst, ind, ind_type, indspec, suffixes[j]); - } else { + + if (indspec->behaviour & INDUSTRYBEH_CARGOTYPES_UNLIMITED) { + /* Reworked behaviour with new many-in-many-out scheme */ + for (uint j = 0; j < lengthof(suffixes); j++) { + if (cargoes[j] != CT_INVALID) { + byte local_id = indspec->grf_prop.grffile->cargo_map[cargoes[j]]; // should we check the value for valid? + uint cargotype = local_id << 16 | use_input; + GetCargoSuffix(cargotype, cst, ind, ind_type, indspec, suffixes[j]); + } else { + suffixes[j].text[0] = '\0'; + suffixes[j].display = CSD_CARGO; + } + } + } else { + /* Compatible behaviour with old 3-in-2-out scheme */ + for (uint j = 0; j < lengthof(suffixes); j++) { suffixes[j].text[0] = '\0'; + suffixes[j].display = CSD_CARGO; + } + switch (use_input) { + case CARGOSUFFIX_OUT: + if (cargoes[0] != CT_INVALID) GetCargoSuffix(3, cst, ind, ind_type, indspec, suffixes[0]); + if (cargoes[1] != CT_INVALID) GetCargoSuffix(4, cst, ind, ind_type, indspec, suffixes[1]); + break; + case CARGOSUFFIX_IN: + if (cargoes[0] != CT_INVALID) GetCargoSuffix(0, cst, ind, ind_type, indspec, suffixes[0]); + if (cargoes[1] != CT_INVALID) GetCargoSuffix(1, cst, ind, ind_type, indspec, suffixes[1]); + if (cargoes[2] != CT_INVALID) GetCargoSuffix(2, cst, ind, ind_type, indspec, suffixes[2]); + break; + default: + NOT_REACHED(); } } } @@ -358,8 +384,8 @@ public: const IndustrySpec *indsp = GetIndustrySpec(this->index[i]); - CargoSuffix cargo_suffix[3]; - GetAllCargoSuffixes(0, CST_FUND, NULL, this->index[i], indsp, indsp->accepts_cargo, cargo_suffix); + CargoSuffix cargo_suffix[lengthof(indsp->accepts_cargo)]; + GetAllCargoSuffixes(CARGOSUFFIX_IN, CST_FUND, NULL, this->index[i], indsp, indsp->accepts_cargo, cargo_suffix); StringID str = STR_INDUSTRY_VIEW_REQUIRES_CARGO; byte p = 0; SetDParam(0, STR_JUST_NOTHING); @@ -373,7 +399,7 @@ public: d = maxdim(d, GetStringBoundingBox(str)); /* Draw the produced cargoes, if any. Otherwise, will print "Nothing". */ - GetAllCargoSuffixes(3, CST_FUND, NULL, this->index[i], indsp, indsp->produced_cargo, cargo_suffix); + GetAllCargoSuffixes(CARGOSUFFIX_OUT, CST_FUND, NULL, this->index[i], indsp, indsp->produced_cargo, cargo_suffix); str = STR_INDUSTRY_VIEW_PRODUCES_CARGO; p = 0; SetDParam(0, STR_JUST_NOTHING); @@ -477,8 +503,8 @@ public: } /* Draw the accepted cargoes, if any. Otherwise, will print "Nothing". */ - CargoSuffix cargo_suffix[3]; - GetAllCargoSuffixes(0, CST_FUND, NULL, this->selected_type, indsp, indsp->accepts_cargo, cargo_suffix); + CargoSuffix cargo_suffix[lengthof(indsp->accepts_cargo)]; + GetAllCargoSuffixes(CARGOSUFFIX_IN, CST_FUND, NULL, this->selected_type, indsp, indsp->accepts_cargo, cargo_suffix); StringID str = STR_INDUSTRY_VIEW_REQUIRES_CARGO; byte p = 0; SetDParam(0, STR_JUST_NOTHING); @@ -493,7 +519,7 @@ public: y += FONT_HEIGHT_NORMAL; /* Draw the produced cargoes, if any. Otherwise, will print "Nothing". */ - GetAllCargoSuffixes(3, CST_FUND, NULL, this->selected_type, indsp, indsp->produced_cargo, cargo_suffix); + GetAllCargoSuffixes(CARGOSUFFIX_OUT, CST_FUND, NULL, this->selected_type, indsp, indsp->produced_cargo, cargo_suffix); str = STR_INDUSTRY_VIEW_PRODUCES_CARGO; p = 0; SetDParam(0, STR_JUST_NOTHING); @@ -508,7 +534,6 @@ public: y += FONT_HEIGHT_NORMAL; /* Get the additional purchase info text, if it has not already been queried. */ - str = STR_NULL; if (HasBit(indsp->callback_mask, CBM_IND_FUND_MORE_TEXT)) { uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, this->selected_type, INVALID_TILE); if (callback_res != CALLBACK_FAILED && callback_res != 0x400) { @@ -684,8 +709,15 @@ static void UpdateIndustryProduction(Industry *i); static inline bool IsProductionAlterable(const Industry *i) { const IndustrySpec *is = GetIndustrySpec(i->type); + bool has_prod = false; + for (size_t j = 0; j < lengthof(is->production_rate); j++) { + if (is->production_rate[j] != 0) { + has_prod = true; + break; + } + } return ((_game_mode == GM_EDITOR || _cheats.setup_prod.value) && - (is->production_rate[0] != 0 || is->production_rate[1] != 0 || is->IsRawIndustry()) && + (has_prod || is->IsRawIndustry()) && !_networking); } @@ -764,8 +796,8 @@ public: y += 2 * FONT_HEIGHT_NORMAL; } - CargoSuffix cargo_suffix[3]; - GetAllCargoSuffixes(0, CST_VIEW, i, i->type, ind, i->accepts_cargo, cargo_suffix); + CargoSuffix cargo_suffix[lengthof(i->accepts_cargo)]; + GetAllCargoSuffixes(CARGOSUFFIX_IN, CST_VIEW, i, i->type, ind, i->accepts_cargo, cargo_suffix); bool stockpiling = HasBit(ind->callback_mask, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_mask, CBM_IND_PRODUCTION_256_TICKS); uint left_side = left + WD_FRAMERECT_LEFT * 4; // Indent accepted cargoes. @@ -804,7 +836,7 @@ public: y += FONT_HEIGHT_NORMAL; } - GetAllCargoSuffixes(3, CST_VIEW, i, i->type, ind, i->produced_cargo, cargo_suffix); + GetAllCargoSuffixes(CARGOSUFFIX_OUT, CST_VIEW, i, i->type, ind, i->produced_cargo, cargo_suffix); first = true; for (byte j = 0; j < lengthof(i->produced_cargo); j++) { if (i->produced_cargo[j] == CT_INVALID) continue; @@ -1256,7 +1288,7 @@ protected: SetDParam(p++, i->index); static CargoSuffix cargo_suffix[lengthof(i->produced_cargo)]; - GetAllCargoSuffixes(3, CST_DIR, i, i->type, indsp, i->produced_cargo, cargo_suffix); + GetAllCargoSuffixes(CARGOSUFFIX_OUT, CST_DIR, i, i->type, indsp, i->produced_cargo, cargo_suffix); /* Industry productions */ for (byte j = 0; j < lengthof(i->produced_cargo); j++) { @@ -1515,7 +1547,7 @@ enum CargoesFieldType { CFT_HEADER, ///< Header text. }; -static const uint MAX_CARGOES = 3; ///< Maximum number of cargoes carried in a #CFT_CARGO field in #CargoesField. +static const uint MAX_CARGOES = 16; ///< Maximum number of cargoes carried in a #CFT_CARGO field in #CargoesField. /** Data about a single field in the #IndustryCargoesWindow panel. */ struct CargoesField { @@ -1523,7 +1555,6 @@ struct CargoesField { static const int HOR_CARGO_BORDER_SPACE; static const int CARGO_STUB_WIDTH; static const int HOR_CARGO_WIDTH, HOR_CARGO_SPACE; - static const int CARGO_FIELD_WIDTH; static const int VERT_CARGO_SPACE, VERT_CARGO_EDGE; static const int BLOB_DISTANCE, BLOB_WIDTH, BLOB_HEIGHT; @@ -1531,7 +1562,9 @@ struct CargoesField { static const int CARGO_LINE_COLOUR; static int small_height, normal_height; + static int cargo_field_width; static int industry_width; + static uint max_cargoes; CargoesFieldType type; ///< Type of field. union { @@ -1580,7 +1613,7 @@ struct CargoesField { /** * Connect a cargo from an industry to the #CFT_CARGO column. * @param cargo Cargo to connect. - * @param produced Cargo is produced (if \c false, cargo is assumed to be accepted). + * @param producer Cargo is produced (if \c false, cargo is assumed to be accepted). * @return Horizontal connection index, or \c -1 if not accepted at all. */ int ConnectCargo(CargoID cargo, bool producer) @@ -1684,20 +1717,19 @@ struct CargoesField { int GetCargoBase(int xpos) const { assert(this->type == CFT_CARGO); + int n = this->u.cargo.num_cargoes; - switch (this->u.cargo.num_cargoes) { - case 0: return xpos + CARGO_FIELD_WIDTH / 2; - case 1: return xpos + CARGO_FIELD_WIDTH / 2 - HOR_CARGO_WIDTH / 2; - case 2: return xpos + CARGO_FIELD_WIDTH / 2 - HOR_CARGO_WIDTH - HOR_CARGO_SPACE / 2; - case 3: return xpos + CARGO_FIELD_WIDTH / 2 - HOR_CARGO_WIDTH - HOR_CARGO_SPACE - HOR_CARGO_WIDTH / 2; - default: NOT_REACHED(); + if (n % 2 == 0) { + return xpos + cargo_field_width / 2 - (HOR_CARGO_WIDTH + HOR_CARGO_SPACE / 2) * (n / 2); + } else { + return xpos + cargo_field_width / 2 - HOR_CARGO_WIDTH / 2 - (HOR_CARGO_WIDTH + HOR_CARGO_SPACE) * (n / 2); } } /** * Draw the field. * @param xpos Position of the left edge. - * @param vpos Position of the top edge. + * @param ypos Position of the top edge. */ void Draw(int xpos, int ypos) const { @@ -1749,7 +1781,7 @@ struct CargoesField { other_left = this->u.industry.other_accepted; } ypos1 += VERT_CARGO_EDGE; - for (uint i = 0; i < MAX_CARGOES; i++) { + for (uint i = 0; i < CargoesField::max_cargoes; i++) { if (other_right[i] != INVALID_CARGO) { const CargoSpec *csp = CargoSpec::Get(other_right[i]); int xp = xpos + industry_width + CARGO_STUB_WIDTH; @@ -1814,7 +1846,7 @@ struct CargoesField { DrawHorConnection(lf + dx - 1, lf + HOR_CARGO_SPACE - 1, ypos, csp); dx = 1; } - DrawHorConnection(cargo_base + col * HOR_CARGO_SPACE + (col + 1) * HOR_CARGO_WIDTH - 1 + dx, xpos + CARGO_FIELD_WIDTH - 1, ypos, csp); + DrawHorConnection(cargo_base + col * HOR_CARGO_SPACE + (col + 1) * HOR_CARGO_WIDTH - 1 + dx, xpos + CargoesField::cargo_field_width - 1, ypos, csp); } ypos += FONT_HEIGHT_NORMAL + VERT_CARGO_SPACE; } @@ -1936,9 +1968,11 @@ private: assert_compile(MAX_CARGOES >= cpp_lengthof(IndustrySpec, produced_cargo)); assert_compile(MAX_CARGOES >= cpp_lengthof(IndustrySpec, accepts_cargo)); -int CargoesField::small_height; ///< Height of the header row. -int CargoesField::normal_height; ///< Height of the non-header rows. -int CargoesField::industry_width; ///< Width of an industry field. +int CargoesField::small_height; ///< Height of the header row. +int CargoesField::normal_height; ///< Height of the non-header rows. +int CargoesField::industry_width; ///< Width of an industry field. +int CargoesField::cargo_field_width; ///< Width of a cargo field. +uint CargoesField::max_cargoes; ///< Largest number of cargoes actually on any industry. const int CargoesField::VERT_INTER_INDUSTRY_SPACE = 6; ///< Amount of space between two industries in a column. const int CargoesField::HOR_CARGO_BORDER_SPACE = 15; ///< Amount of space between the left/right edge of a #CFT_CARGO field, and the left/right most vertical cargo. @@ -1952,9 +1986,6 @@ const int CargoesField::BLOB_DISTANCE = 5; ///< Distance of the industry legend const int CargoesField::BLOB_WIDTH = 12; ///< Width of the industry legend colour, including border. const int CargoesField::BLOB_HEIGHT = 9; ///< Height of the industry legend colour, including border -/** Width of a #CFT_CARGO field. */ -const int CargoesField::CARGO_FIELD_WIDTH = HOR_CARGO_BORDER_SPACE * 2 + HOR_CARGO_WIDTH * MAX_CARGOES + HOR_CARGO_SPACE * (MAX_CARGOES - 1); - const int CargoesField::INDUSTRY_LINE_COLOUR = PC_YELLOW; ///< Line colour of the industry type box. const int CargoesField::CARGO_LINE_COLOUR = PC_YELLOW; ///< Line colour around the cargo. @@ -1979,13 +2010,14 @@ struct CargoesRow { int other_count = 0; const IndustrySpec *indsp = GetIndustrySpec(ind_fld->u.industry.ind_type); - for (uint i = 0; i < lengthof(indsp->produced_cargo); i++) { + assert(CargoesField::max_cargoes <= lengthof(indsp->produced_cargo)); + for (uint i = 0; i < CargoesField::max_cargoes; i++) { int col = cargo_fld->ConnectCargo(indsp->produced_cargo[i], true); if (col < 0) others[other_count++] = indsp->produced_cargo[i]; } /* Allocate other cargoes in the empty holes of the horizontal cargo connections. */ - for (uint i = 0; i < MAX_CARGOES && other_count > 0; i++) { + for (uint i = 0; i < CargoesField::max_cargoes && other_count > 0; i++) { if (cargo_fld->u.cargo.supp_cargoes[i] == INVALID_CARGO) ind_fld->u.industry.other_produced[i] = others[--other_count]; } } else { @@ -2036,13 +2068,14 @@ struct CargoesRow { int other_count = 0; const IndustrySpec *indsp = GetIndustrySpec(ind_fld->u.industry.ind_type); - for (uint i = 0; i < lengthof(indsp->accepts_cargo); i++) { + assert(CargoesField::max_cargoes <= lengthof(indsp->accepts_cargo)); + for (uint i = 0; i < CargoesField::max_cargoes; i++) { int col = cargo_fld->ConnectCargo(indsp->accepts_cargo[i], false); if (col < 0) others[other_count++] = indsp->accepts_cargo[i]; } /* Allocate other cargoes in the empty holes of the horizontal cargo connections. */ - for (uint i = 0; i < MAX_CARGOES && other_count > 0; i++) { + for (uint i = 0; i < CargoesField::max_cargoes && other_count > 0; i++) { if (cargo_fld->u.cargo.cust_cargoes[i] == INVALID_CARGO) ind_fld->u.industry.other_accepted[i] = others[--other_count]; } } else { @@ -2125,10 +2158,13 @@ struct IndustryCargoesWindow : public Window { /* Decide about the size of the box holding the text of an industry type. */ this->ind_textsize.width = 0; this->ind_textsize.height = 0; + CargoesField::max_cargoes = 0; for (IndustryType it = 0; it < NUM_INDUSTRYTYPES; it++) { const IndustrySpec *indsp = GetIndustrySpec(it); if (!indsp->enabled) continue; this->ind_textsize = maxdim(this->ind_textsize, GetStringBoundingBox(indsp->name)); + CargoesField::max_cargoes = max(CargoesField::max_cargoes, std::count_if(indsp->accepts_cargo, endof(indsp->accepts_cargo), IsCargoIDValid)); + CargoesField::max_cargoes = max(CargoesField::max_cargoes, std::count_if(indsp->produced_cargo, endof(indsp->produced_cargo), IsCargoIDValid)); } d.width = max(d.width, this->ind_textsize.width); d.height = this->ind_textsize.height; @@ -2147,18 +2183,21 @@ struct IndustryCargoesWindow : public Window { d.width += 2 * HOR_TEXT_PADDING; /* Ensure the height is enough for the industry type text, for the horizontal connections, and for the cargo labels. */ - uint min_ind_height = CargoesField::VERT_CARGO_EDGE * 2 + MAX_CARGOES * FONT_HEIGHT_NORMAL + (MAX_CARGOES - 1) * CargoesField::VERT_CARGO_SPACE; + uint min_ind_height = CargoesField::VERT_CARGO_EDGE * 2 + CargoesField::max_cargoes * FONT_HEIGHT_NORMAL + (CargoesField::max_cargoes - 1) * CargoesField::VERT_CARGO_SPACE; d.height = max(d.height + 2 * VERT_TEXT_PADDING, min_ind_height); CargoesField::industry_width = d.width; CargoesField::normal_height = d.height + CargoesField::VERT_INTER_INDUSTRY_SPACE; + + /* Width of a #CFT_CARGO field. */ + CargoesField::cargo_field_width = CargoesField::HOR_CARGO_BORDER_SPACE * 2 + CargoesField::HOR_CARGO_WIDTH * CargoesField::max_cargoes + CargoesField::HOR_CARGO_SPACE * (CargoesField::max_cargoes - 1); } virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) { switch (widget) { case WID_IC_PANEL: - size->width = WD_FRAMETEXT_LEFT + CargoesField::industry_width * 3 + CargoesField::CARGO_FIELD_WIDTH * 2 + WD_FRAMETEXT_RIGHT; + size->width = WD_FRAMETEXT_LEFT + CargoesField::industry_width * 3 + CargoesField::cargo_field_width * 2 + WD_FRAMETEXT_RIGHT; break; case WID_IC_IND_DROPDOWN: @@ -2527,7 +2566,7 @@ struct IndustryCargoesWindow : public Window { _cur_dpi = &tmp_dpi; int left_pos = WD_FRAMERECT_LEFT; - if (this->ind_cargo >= NUM_INDUSTRYTYPES) left_pos += (CargoesField::industry_width + CargoesField::CARGO_FIELD_WIDTH) / 2; + if (this->ind_cargo >= NUM_INDUSTRYTYPES) left_pos += (CargoesField::industry_width + CargoesField::cargo_field_width) / 2; int last_column = (this->ind_cargo < NUM_INDUSTRYTYPES) ? 4 : 2; const NWidgetBase *nwp = this->GetWidget(WID_IC_PANEL); @@ -2546,7 +2585,7 @@ struct IndustryCargoesWindow : public Window { } while (col >= 0 && col <= last_column) { this->fields[i].columns[col].Draw(xpos, vpos); - xpos += (col & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width; + xpos += (col & 1) ? CargoesField::cargo_field_width : CargoesField::industry_width; col += dir; } } @@ -2578,11 +2617,11 @@ struct IndustryCargoesWindow : public Window { vpos = pt.y - vpos - row * CargoesField::normal_height; // Position in the row + 1 field row++; // rebase row to match index of this->fields. - int xpos = 2 * WD_FRAMERECT_LEFT + ((this->ind_cargo < NUM_INDUSTRYTYPES) ? 0 : (CargoesField::industry_width + CargoesField::CARGO_FIELD_WIDTH) / 2); + int xpos = 2 * WD_FRAMERECT_LEFT + ((this->ind_cargo < NUM_INDUSTRYTYPES) ? 0 : (CargoesField::industry_width + CargoesField::cargo_field_width) / 2); if (pt.x < xpos) return false; int column; for (column = 0; column <= 5; column++) { - int width = (column & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width; + int width = (column & 1) ? CargoesField::cargo_field_width : CargoesField::industry_width; if (pt.x < xpos + width) break; xpos += width; } @@ -2595,7 +2634,7 @@ struct IndustryCargoesWindow : public Window { xy->y = vpos; if (_current_text_dir == TD_RTL) { fieldxy->x = num_columns - column; - xy->x = ((column & 1) ? CargoesField::CARGO_FIELD_WIDTH : CargoesField::industry_width) - xpos; + xy->x = ((column & 1) ? CargoesField::cargo_field_width : CargoesField::industry_width) - xpos; } else { fieldxy->x = column; xy->x = xpos; diff --git a/src/industry_type.h b/src/industry_type.h index 6234f7b114..9a8a469017 100644 --- a/src/industry_type.h +++ b/src/industry_type.h @@ -37,6 +37,10 @@ static const IndustryGfx INVALID_INDUSTRYTILE = NUM_INDUSTRYTILES; ///< one a static const int INDUSTRY_COMPLETED = 3; ///< final stage of industry construction. +static const int INDUSTRY_NUM_INPUTS = 16; ///< Number of cargo types an industry can accept +static const int INDUSTRY_NUM_OUTPUTS = 16; ///< Number of cargo types an industry can produce + + void CheckIndustries(); #endif /* INDUSTRY_TYPE_H */ diff --git a/src/industrytype.h b/src/industrytype.h index 03b6c79736..cd451fa777 100644 --- a/src/industrytype.h +++ b/src/industrytype.h @@ -80,6 +80,7 @@ enum IndustryBehaviour { INDUSTRYBEH_PRODCALLBACK_RANDOM = 1 << 15, ///< Production callback needs random bits in var 10 INDUSTRYBEH_NOBUILT_MAPCREATION = 1 << 16, ///< Do not force one instance of this type to appear on map generation INDUSTRYBEH_CANCLOSE_LASTINSTANCE = 1 << 17, ///< Allow closing down the last instance of this type + INDUSTRYBEH_CARGOTYPES_UNLIMITED = 1 << 18, ///< Allow produced/accepted cargoes callbacks to supply more than 2 and 3 types }; DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour) @@ -87,6 +88,7 @@ DECLARE_ENUM_AS_BIT_SET(IndustryBehaviour) enum IndustryTileSpecialFlags { INDTILE_SPECIAL_NONE = 0, INDTILE_SPECIAL_NEXTFRAME_RANDOMBITS = 1 << 0, ///< Callback 0x26 needs random bits + INDTILE_SPECIAL_ACCEPTS_ALL_CARGO = 1 << 1, ///< Tile always accepts all cargoes the associated industry accepts }; DECLARE_ENUM_AS_BIT_SET(IndustryTileSpecialFlags) @@ -99,41 +101,41 @@ struct IndustryTileTable { * Defines the data structure for constructing industry. */ struct IndustrySpec { - const IndustryTileTable * const *table;///< List of the tiles composing the industry - byte num_table; ///< Number of elements in the table - uint8 cost_multiplier; ///< Base construction cost multiplier. - uint32 removal_cost_multiplier; ///< Base removal cost multiplier. - uint32 prospecting_chance; ///< Chance prospecting succeeds - IndustryType conflicting[3]; ///< Industries this industry cannot be close to - byte check_proc; ///< Index to a procedure to check for conflicting circumstances - CargoID produced_cargo[2]; - byte production_rate[2]; + const IndustryTileTable * const *table; ///< List of the tiles composing the industry + byte num_table; ///< Number of elements in the table + uint8 cost_multiplier; ///< Base construction cost multiplier. + uint32 removal_cost_multiplier; ///< Base removal cost multiplier. + uint32 prospecting_chance; ///< Chance prospecting succeeds + IndustryType conflicting[3]; ///< Industries this industry cannot be close to + byte check_proc; ///< Index to a procedure to check for conflicting circumstances + CargoID produced_cargo[INDUSTRY_NUM_OUTPUTS]; + byte production_rate[INDUSTRY_NUM_OUTPUTS]; /** * minimum amount of cargo transported to the stations. * If the waiting cargo is less than this number, no cargo is moved to it. */ byte minimal_cargo; - CargoID accepts_cargo[3]; ///< 3 accepted cargoes. - uint16 input_cargo_multiplier[3][2]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes) - IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs - byte climate_availability; ///< Bitmask, giving landscape enums as bit position - IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it - byte map_colour; ///< colour used for the small map - 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 - StringID station_name; ///< Default name for nearby station - byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game - byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation - uint8 number_of_sounds; ///< Number of sounds available in the sounds array - const uint8 *random_sounds; ///< array of random sounds. + CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]; ///< 16 accepted cargoes. + uint16 input_cargo_multiplier[INDUSTRY_NUM_INPUTS][INDUSTRY_NUM_OUTPUTS]; ///< Input cargo multipliers (multiply amount of incoming cargo for the produced cargoes) + IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs + byte climate_availability; ///< Bitmask, giving landscape enums as bit position + IndustryBehaviour behaviour; ///< How this industry will behave, and how others entities can use it + byte map_colour; ///< colour used for the small map + 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 + StringID station_name; ///< Default name for nearby station + byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game + byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation + uint8 number_of_sounds; ///< Number of sounds available in the sounds array + const uint8 *random_sounds; ///< array of random sounds. /* Newgrf data */ - uint16 callback_mask; ///< Bitmask of industry callbacks that have to be called - uint8 cleanup_flag; ///< flags indicating which data should be freed upon cleaning up - bool enabled; ///< entity still available (by default true).newgrf can disable it, though - GRFFileProps grf_prop; ///< properties related to the grf file + uint16 callback_mask; ///< Bitmask of industry callbacks that have to be called + uint8 cleanup_flag; ///< flags indicating which data should be freed upon cleaning up + bool enabled; ///< entity still available (by default true).newgrf can disable it, though + GRFFileProps grf_prop; ///< properties related to the grf file bool IsRawIndustry() const; bool IsProcessingIndustry() const; @@ -144,10 +146,11 @@ struct IndustrySpec { /** * Defines the data structure of each individual tile of an industry. + * @note A tile can at most accept 3 types of cargo, even if an industry as a whole can accept more types. */ struct IndustryTileSpec { - CargoID accepts_cargo[3]; ///< Cargo accepted by this tile - uint8 acceptance[3]; ///< Level of acceptance per cargo type + CargoID accepts_cargo[INDUSTRY_NUM_INPUTS]; ///< Cargo accepted by this tile + int8 acceptance[INDUSTRY_NUM_INPUTS]; ///< Level of acceptance per cargo type (signed, may be negative!) Slope slopes_refused; ///< slope pattern on which this tile cannot be built byte anim_production; ///< Animation frame to start when goods are produced byte anim_next; ///< Next frame in an animation diff --git a/src/ini_type.h b/src/ini_type.h index ce383b959c..9bd47fd4e5 100644 --- a/src/ini_type.h +++ b/src/ini_type.h @@ -70,7 +70,7 @@ struct IniLoadFile { * Open the INI file. * @param filename Name of the INI file. * @param subdir The subdir to load the file from. - * @param size [out] Size of the opened file. + * @param[out] size Size of the opened file. * @return File handle of the opened file, or \c NULL. */ virtual FILE *OpenFile(const char *filename, Subdirectory subdir, size_t *size) = 0; diff --git a/src/lang/afrikaans.txt b/src/lang/afrikaans.txt index 432c5f8391..7f2a4528bd 100644 --- a/src/lang/afrikaans.txt +++ b/src/lang/afrikaans.txt @@ -4204,7 +4204,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Te veel STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Te veel treinstasie deele STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Te veel bushalte STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Te veel vragmotor stasies -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Te naby aan 'n ander stasie/laai area STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Te naby aan 'n ander werf STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Te naby aan 'n ander lughawe STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Stasie kan nie hernoem word nie... diff --git a/src/lang/arabic_egypt.txt b/src/lang/arabic_egypt.txt index 99947d87a2..06ae75e84d 100644 --- a/src/lang/arabic_egypt.txt +++ b/src/lang/arabic_egypt.txt @@ -3667,7 +3667,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}يوجد STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}يوجد الكثير من قطاعات محطه السكه الحديديه STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}يوجد الكثير من محطات الحافلات STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}يوجد الكثير من محطات الشاحنات -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}قريب للغايه من محطه اخرى STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}قريب للغايه من مَرسَى اخر STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}قريب للغايه من مطار اخر STR_ERROR_CAN_T_RENAME_STATION :{WHITE}تعذر إعاده تسميه المحطه... diff --git a/src/lang/basque.txt b/src/lang/basque.txt index 8daa2034a9..3c33bc4533 100644 --- a/src/lang/basque.txt +++ b/src/lang/basque.txt @@ -4076,7 +4076,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Geltoki STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Tren geltoki zati gehiegi STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Autobus geltoki gehiegi STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Kamioi geltoki gehiegi -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Geltoki batetik hurbilegi STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Kai batetik hurbilegi STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Aireportu batetik hurbilegi STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Ezinda geltokia berrizendatu... diff --git a/src/lang/belarusian.txt b/src/lang/belarusian.txt index a07ceecedb..bc0eaa9546 100644 --- a/src/lang/belarusian.txt +++ b/src/lang/belarusian.txt @@ -4588,7 +4588,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Зана STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Занадта вялікая чыгуначная станцыя STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Занадта шмат аўтобусных прыпынкаў STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Занадта шмат грузавых тэрмiналаў -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Занадта блізка да іншай станцыі STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Занадта блізка да іншай прыстані STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Занадта блізка да іншага аэрапорта STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Немагчыма перайменаваць станцыю... diff --git a/src/lang/brazilian_portuguese.txt b/src/lang/brazilian_portuguese.txt index 2318af9da5..54ed6800fb 100644 --- a/src/lang/brazilian_portuguese.txt +++ b/src/lang/brazilian_portuguese.txt @@ -4278,7 +4278,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Estaçõ STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}A estação já tem muitas partes STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Estações de ônibus demais STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Áreas de carga demais -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Muito perto de outra estação/local de carga STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Muito perto de outra doca STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Muito perto de outro aeroporto STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Impossível renomear a estação... diff --git a/src/lang/bulgarian.txt b/src/lang/bulgarian.txt index f142a10e9b..ddb4d651da 100644 --- a/src/lang/bulgarian.txt +++ b/src/lang/bulgarian.txt @@ -4133,7 +4133,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Твър STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Твърде много части на гара STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Твърде много автобусни спирки STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Твърде много гари за камиони -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Твърде близо до друга гара/товарна платформа STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Прекалено близо до друг док STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Прекалено близо до друго летище STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Станцията не може да бъде преименувана... diff --git a/src/lang/catalan.txt b/src/lang/catalan.txt index d06bfd789c..e1f2fcf65a 100644 --- a/src/lang/catalan.txt +++ b/src/lang/catalan.txt @@ -4280,7 +4280,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Massa es STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Hi ha massa parts d'estacions de tren STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Massa parades d'autobús STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Masses estacions de càrrega -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Massa prop d'una altra estació/àrea de càrrega STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Massa prop d'un altre moll STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Massa prop d'un altre aeroport STR_ERROR_CAN_T_RENAME_STATION :{WHITE}No es pot canviar el nom de l'estació... diff --git a/src/lang/croatian.txt b/src/lang/croatian.txt index a30ea1f793..29a9f0f073 100644 --- a/src/lang/croatian.txt +++ b/src/lang/croatian.txt @@ -4377,7 +4377,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Previše STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Previše dijelova željezničke postaje STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Previše autobusnih postaja STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Previše kamionskih postaja -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Preblizu drugoj postaji/terminalu STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Preblizu drugom pristaništu STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Preblizu drugoj zračnoj luci STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Nije moguće preimenovati postaju... diff --git a/src/lang/czech.txt b/src/lang/czech.txt index 80fbe50b8b..2853efdaa1 100644 --- a/src/lang/czech.txt +++ b/src/lang/czech.txt @@ -4341,7 +4341,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Příli STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Příliš mnoho staničních částí STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Příliš mnoho autobusových zastávek STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Příliš mnoho zastávek nákladních automobilů -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Příliš blízko k jinému nádraží nebo nákladové rampě STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Příliš blízko k jinému doku STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Příliš blízko k jinému letišti STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Nelze přejmenovat stanici... diff --git a/src/lang/danish.txt b/src/lang/danish.txt index 4dd091abf5..7b7d568253 100644 --- a/src/lang/danish.txt +++ b/src/lang/danish.txt @@ -4229,7 +4229,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}For mang STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Banegården er i for mange dele STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}For mange busterminaler STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}For mange fragtcentraler -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}For tæt på en anden station/fragtcentral STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}For tæt på en anden havn STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}For tæt på en anden lufthavn STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kan ikke omdøbe stationen... diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index be40fa1f95..623f07a90c 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -4280,7 +4280,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Te veel STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Te veel treinstationsdelen STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Te veel bushaltes STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Te veel vrachtwagenlaadstations -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Te dicht bij een ander (laad)station STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Te dicht bij een andere haven STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Te dicht bij een ander vliegveld STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kan stationsnaam niet veranderen... diff --git a/src/lang/english.txt b/src/lang/english.txt index 9002486a46..b000c535b1 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3477,6 +3477,8 @@ STR_NEWGRF_ERROR_READ_BOUNDS :Read past end o STR_NEWGRF_ERROR_GRM_FAILED :Requested GRF resources not available (sprite {3:NUM}) STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{1:RAW_STRING} was disabled by {2:RAW_STRING} STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :Invalid/unknown sprite layout format (sprite {3:NUM}) +STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG :Too many elements in property value list (sprite {3:NUM}, property {4:HEX}) +STR_NEWGRF_ERROR_INDPROD_CALLBACK :Invalid industry production callback (sprite {3:NUM}, "{1:RAW_STRING}") # NewGRF related 'general' warnings STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Caution! @@ -5127,7 +5129,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Too many STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Too many railway station parts STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Too many bus stops STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Too many lorry stations -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Too close to another station/loading area STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Too close to another dock STR_ERROR_TOO_MANY_DOCKS :{WHITE}Too many docks STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Too close to another airport diff --git a/src/lang/english_AU.txt b/src/lang/english_AU.txt index 54430ca5bc..60b53778fd 100644 --- a/src/lang/english_AU.txt +++ b/src/lang/english_AU.txt @@ -4153,7 +4153,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Too many STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Too many railway station parts STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Too many bus stops STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Too many Truck stations -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Too close to another station/loading area STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Too close to another dock STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Too close to another airport STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Can't rename station... diff --git a/src/lang/english_US.txt b/src/lang/english_US.txt index aca58053a1..663d7e8543 100644 --- a/src/lang/english_US.txt +++ b/src/lang/english_US.txt @@ -4235,7 +4235,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Too many STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Too many railroad station parts STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Too many bus stops STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Too many truck stations -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Too close to another station/loading area STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Too close to another dock STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Too close to another airport STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Can't rename station... diff --git a/src/lang/esperanto.txt b/src/lang/esperanto.txt index 76f258b7ec..30795bbdf7 100644 --- a/src/lang/esperanto.txt +++ b/src/lang/esperanto.txt @@ -3579,7 +3579,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Tro da s STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Tro da partoj de stacidomo STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Tro da bushaltejoj STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Tro da ŝarĝaŭtaj stacioj -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Tro proksime al alia stacioj/ŝarĝejoj STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Tro proksime al alia haveno STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Tro proksime al alia flughaveno STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Ne povas alinomi stacion... diff --git a/src/lang/estonian.txt b/src/lang/estonian.txt index 7724554c0f..3b489d00ec 100644 --- a/src/lang/estonian.txt +++ b/src/lang/estonian.txt @@ -4261,7 +4261,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Liiga pa STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Liiga palju raudteejaama osasid STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Liiga palju bussipeatusi STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Liiga palju laadimisplatvorme -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Mõnele teisele jaamale liiga lähedal STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Liiga lähedal teisele dokile STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Liiga lähedal teisele lennuväljale STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Jaama nime ei saa vahetada... diff --git a/src/lang/faroese.txt b/src/lang/faroese.txt index b9d07924b9..f17a68e495 100644 --- a/src/lang/faroese.txt +++ b/src/lang/faroese.txt @@ -3723,7 +3723,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Ov nógv STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Ov nógvir tok støð deilir STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Ov nógvir buss steðgir STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Ov nógvar lastbila støðir -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Ov tætt við eina aðra støð/lessi øki STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Ov tætt við eina aðra havn STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Ov tætt við eina aðra floghavn STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kann ikki navngeva støð... diff --git a/src/lang/finnish.txt b/src/lang/finnish.txt index 710a89f1b1..246f83e482 100644 --- a/src/lang/finnish.txt +++ b/src/lang/finnish.txt @@ -4244,7 +4244,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Liian mo STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Rautatieasema on jakautunut liian moneen osaan STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Liian monta linja-autopysäkkiä. STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Liian monta lastauslaituria. -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Liian lähellä toista asemaa tai lastausaluetta. STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Liian lähellä toista satamaa. STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Liian lähellä toista lentokenttää. STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Asemaa ei voi nimetä uudelleen. diff --git a/src/lang/french.txt b/src/lang/french.txt index a55d350977..ec56c02c37 100644 --- a/src/lang/french.txt +++ b/src/lang/french.txt @@ -4281,7 +4281,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Trop de STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Trop de parties de gare STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Trop d'arrêts d'autobus STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Trop d'aires de chargement -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Trop près d'une autre gare STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Trop près d'un autre port STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Trop près d'un autre aéroport STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Impossible de renommer la gare... diff --git a/src/lang/gaelic.txt b/src/lang/gaelic.txt index 670c7858ca..79542e2900 100644 --- a/src/lang/gaelic.txt +++ b/src/lang/gaelic.txt @@ -4463,7 +4463,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Cus stè STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Cus pàirtean dhe stèisean-rèile STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Gus stèiseanan bus STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Tha cus ionadan-luchdaidh nan làraidh ann -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Ro fhaisg air stèisean/ionad-luchdaidh eile STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Ro fhaisg air port eile STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Ro fhaisg air port-adhair eile STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Cha ghabh ainm an stèisein atharrachadh... diff --git a/src/lang/galician.txt b/src/lang/galician.txt index fbfe6cb440..93c487d3d9 100644 --- a/src/lang/galician.txt +++ b/src/lang/galician.txt @@ -4223,7 +4223,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Demasiad STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Demasiadas partes de estación de tren STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Demasiadas paradas de autobús STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Demasiadas estacións de camións -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Demasiado preto doutra estación ou área de carga STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Demasiado preto doutro peirao STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Demasiado preto doutro aeroporto STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Non se pode renomear a estación... diff --git a/src/lang/german.txt b/src/lang/german.txt index e081245c89..001b4cf7a3 100644 --- a/src/lang/german.txt +++ b/src/lang/german.txt @@ -4938,7 +4938,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Zu viele STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Zu viele Bahnsteigteile STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Zu viele Bushaltestellen STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Zu viele Lkw-Ladeplätze -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Stationen liegen zu dicht beisammen STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Zu dicht an einem anderen Hafen STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Zu dicht an einem anderen Flughafen STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Station kann nicht umbenannt werden... diff --git a/src/lang/greek.txt b/src/lang/greek.txt index 463c2c855a..31a9d614b1 100644 --- a/src/lang/greek.txt +++ b/src/lang/greek.txt @@ -4372,7 +4372,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Πάρα STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Πάρα πολλά κομμάτια σιδηροδρομικού σταθμού STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Πάρα πολλές στάσεις λεωφορείου STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Πάρα πολλοί σταθμοί φορτηγών -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Πολύ κοντά σε άλλη περιοχή σταθμού/φόρτωσης STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Πολύ κοντά σε άλλη αποβάθρα STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Πολύ κοντά σε άλλο αεροδρόμιο STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Δεν μπορεί να μετονομαστεί ο σταθμός... diff --git a/src/lang/hebrew.txt b/src/lang/hebrew.txt index 475674fc97..bc1d4fb83b 100644 --- a/src/lang/hebrew.txt +++ b/src/lang/hebrew.txt @@ -4256,7 +4256,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}יותר STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}התחנה מורכבת מיותר מידי חלקים STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}יותר מידי תחנות אוטובוס STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}יותר מידי תחנות משאיות -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}קרוב מידי לתחנה או איזור טעינה אחרים STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}יותר מידי קרוב למזח אחר STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}קרוב מידי לשדה תעופה אחר STR_ERROR_CAN_T_RENAME_STATION :{WHITE}לא ניתן לשנות שם תחנה... diff --git a/src/lang/hungarian.txt b/src/lang/hungarian.txt index 7fb3057a57..3f96ecd254 100644 --- a/src/lang/hungarian.txt +++ b/src/lang/hungarian.txt @@ -4286,7 +4286,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Túl sok STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Túl sok vasútállomás-rész STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Túl sok buszmegálló STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Túl sok a teherautó-rakodóhely -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Túl közel van egy másik állomáshoz/rakodóhelyhez STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Túl közel van egy másik kikötőhöz STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Túl közel van egy másik repülőtérhez STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Nem nevezheted át az állomást... diff --git a/src/lang/icelandic.txt b/src/lang/icelandic.txt index 79c1dea019..984ffde824 100644 --- a/src/lang/icelandic.txt +++ b/src/lang/icelandic.txt @@ -3966,7 +3966,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Of marga STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Of margir hlutar af lestarstöðvum STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Of margar strætisvagnastöðvar STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Of margar vörubílastöðvar -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Of nálægt annarri stöð/lestunarsvæði STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Of nálægt annarri bryggju STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Of nálægt öðrum flugvelli STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Get ekki endurnefnt stöð... diff --git a/src/lang/indonesian.txt b/src/lang/indonesian.txt index 7140d58845..2117243951 100644 --- a/src/lang/indonesian.txt +++ b/src/lang/indonesian.txt @@ -4203,7 +4203,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Terlalu STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Terlalu banyak bag. stasiun STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Terlalu banyak pemberhentian Bus STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Terlalu banyak terminal truk -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Terlalu dekat dengan stasiun/area bongkar muat lainnya STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Terlalu dekat dengan dok/galangan kapal lainnya STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Terlalu dekat dengan bandara lainnya STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Tidak dapat mengganti nama stasiun... diff --git a/src/lang/irish.txt b/src/lang/irish.txt index 7563c25904..32153a23b1 100644 --- a/src/lang/irish.txt +++ b/src/lang/irish.txt @@ -4203,7 +4203,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}An iomar STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}An iomarca codanna stáisiún iarnróid STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}An iomarca stadanna bus STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}An iomarca stáisiúin leoraithe -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Roghearr do stáisiún/limistéar lódála eile STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Roghearr do dug eile STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Roghearr d'aerfort eile STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Ní féidir an stáisiún a athainmniú... diff --git a/src/lang/italian.txt b/src/lang/italian.txt index 4081c1a724..f0ebd2b362 100644 --- a/src/lang/italian.txt +++ b/src/lang/italian.txt @@ -2998,6 +2998,8 @@ STR_NEWGRF_ERROR_READ_BOUNDS :Lettura oltre l STR_NEWGRF_ERROR_GRM_FAILED :Risorsa GRF richiesta non disponibile (sprite {3:NUM}) STR_NEWGRF_ERROR_FORCEFULLY_DISABLED :{1:STRING} è stato disabilitato da {STRING} STR_NEWGRF_ERROR_INVALID_SPRITE_LAYOUT :Formato di layout dello sprite sconosciuto o non valido (sprite {3:NUM}) +STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG :Troppi elementi nella lista valori di una proprietà (sprite {3:NUM}, proprietà {4:HEX}) +STR_NEWGRF_ERROR_INDPROD_CALLBACK :Callback di produzione industria non valido (sprite {3:NUM}, "{1:STRING}") # NewGRF related 'general' warnings STR_NEWGRF_POPUP_CAUTION_CAPTION :{WHITE}Attenzione! @@ -4311,7 +4313,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Troppe s STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Stazione composta da troppe parti STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Troppe stazioni degli autobus STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Troppe aree di carico per camion -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Troppo vicino ad un'altra stazione/area di carico STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Troppo vicino ad un altro molo STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Troppo vicino ad un altro aeroporto STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Impossibile rinominare la stazione... diff --git a/src/lang/japanese.txt b/src/lang/japanese.txt index 2ee3df8484..cee27168f3 100644 --- a/src/lang/japanese.txt +++ b/src/lang/japanese.txt @@ -4206,7 +4206,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}停留 STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}駅の部分が多すぎます STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}バス停が多すぎます STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}荷役所が多すぎます -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}他の停留施設に近すぎます STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}他の埠頭に近すぎます STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}他の空港に近すぎます STR_ERROR_CAN_T_RENAME_STATION :{WHITE}駅名を変更できません diff --git a/src/lang/korean.txt b/src/lang/korean.txt index f978dc3354..294b881367 100644 --- a/src/lang/korean.txt +++ b/src/lang/korean.txt @@ -5055,7 +5055,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}역이 STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}철도역 조각이 너무 많습니다 STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}버스 정류장이 너무 많습니다 STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}트럭 적하장이 너무 많습니다 -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}다른 역과 너무 가깝습니다! STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}다른 항구와 너무 가깝습니다! STR_ERROR_TOO_MANY_DOCKS :{WHITE}항구가 너무 많습니다! STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}다른 공항과 너무 가깝습니다! diff --git a/src/lang/latin.txt b/src/lang/latin.txt index fdaa1cc4c7..62c882239e 100644 --- a/src/lang/latin.txt +++ b/src/lang/latin.txt @@ -4438,7 +4438,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Nimis st STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Nimis partes stationum ferriviariarum adsunt STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Nimis stationes laophoricae adsunt STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Nimis stationes autoplaustricae adsunt -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Nimis prope aliam stationem STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Nimis prope aliud navale STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Nimis prope alium aeroportum STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Non licet stationem renominare... diff --git a/src/lang/latvian.txt b/src/lang/latvian.txt index 232242342f..5ea800384e 100644 --- a/src/lang/latvian.txt +++ b/src/lang/latvian.txt @@ -1274,6 +1274,7 @@ STR_CONFIG_SETTING_LANDSCAPE :Ainava: {STRING STR_CONFIG_SETTING_LAND_GENERATOR :Zemes radītājs: {STRING} STR_CONFIG_SETTING_LAND_GENERATOR_ORIGINAL :Sākotnējais STR_CONFIG_SETTING_LAND_GENERATOR_TERRA_GENESIS :TerraGenesis +STR_CONFIG_SETTING_TERRAIN_TYPE_HELPTEXT :(Tikai TerraGenesis) Ainavas kalnainība STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE :Maksimālais attālums no kartes malas naftas pārstrādes rūpnīcām: {STRING} STR_CONFIG_SETTING_OIL_REF_EDGE_DISTANCE_HELPTEXT :Naftas pārstrādes rūpnīcas ir būvējamas tikai kartes malu tuvumā, salu kartēm tas ir pie krasta STR_CONFIG_SETTING_SNOWLINE_HEIGHT :Sniega līnijas augstums: {STRING} @@ -2627,6 +2628,7 @@ STR_ABOUT_COPYRIGHT_OPENTTD :{BLACK}OpenTTD # Framerate display window STR_FRAMERATE_SPEED_FACTOR :{WHITE}pašreizējās spēles ātruma pakāpe: {DECIMAL}x +STR_FRAMERATE_SPEED_FACTOR_TOOLTIP :{BLACK}Cik ātri spēle šobrīd iet salīdzinot ar standarta ātrumu. ############ Leave those lines in this order!! ############ End of leave-in-this-order ############ Leave those lines in this order!! @@ -3224,6 +3226,7 @@ STR_INDUSTRY_VIEW_PRODUCTION_LAST_MONTH_TITLE :{BLACK}Iepriek STR_INDUSTRY_VIEW_TRANSPORTED :{YELLOW}{CARGO_LONG}{STRING}{BLACK} (aizvests {COMMA}%) STR_INDUSTRY_VIEW_LOCATION_TOOLTIP :{BLACK}Centrēt galveno skatu uz ražotni. Ctrl+klikšķis atvērs skatu uz ražotni jaunā skatlaukā STR_INDUSTRY_VIEW_PRODUCTION_LEVEL :{BLACK}Ražošanas līmenis: {YELLOW}{COMMA}% +STR_INDUSTRY_VIEW_INDUSTRY_ANNOUNCED_CLOSURE :{YELLOW}Nozare ir paziņojusi par nenovēršamu slēgšanu! ############ range for requires starts STR_INDUSTRY_VIEW_REQUIRES_CARGO :{BLACK}Nepieciešams: {YELLOW}{STRING}{STRING} @@ -4131,7 +4134,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Pārāk STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Pārāk daudz dzelzceļa stacijas daļu STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Pārāk daudz autobusu pieturvietu STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Pārāk daudz kravas automobiļu staciju -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Pārāk tuvu citai stacijai/iekraušanas zonai STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Pārāk tuvu citai piestātnei STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Pārāk tuvu citai lidostai STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Nevar pārdēvēt staciju... diff --git a/src/lang/lithuanian.txt b/src/lang/lithuanian.txt index 09d8749dbc..b86e380faa 100644 --- a/src/lang/lithuanian.txt +++ b/src/lang/lithuanian.txt @@ -4478,7 +4478,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Per daug STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Perdaug traukinių stoties dalių STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Per daug autobusų stotelių STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Per daug sunkvežimių pakrovimo aikstelių -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Per arti kitos stotelės STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Per arti kitos prieplaukos STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Per arti kito oro uosto STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Stotelės pervardinti negalima... diff --git a/src/lang/luxembourgish.txt b/src/lang/luxembourgish.txt index 0d0e7fd87f..0830605ac5 100644 --- a/src/lang/luxembourgish.txt +++ b/src/lang/luxembourgish.txt @@ -4222,7 +4222,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Ze vill STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Ze vill Garesdeeler STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Ze vill Busarrêten STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Ze vill Camionsgaren -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Ze noo un enger aanerer Gare/Luedstatioun STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Ze noo un engem aanerem Hafen STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Ze noo un engem aaneren Fluchhafen STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kann d'Statioun net ëmbenennen... diff --git a/src/lang/malay.txt b/src/lang/malay.txt index 2f2749840a..a84943dc83 100644 --- a/src/lang/malay.txt +++ b/src/lang/malay.txt @@ -3878,7 +3878,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Terlampa STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Terlampau banyak bahagian-bahagian stesen keretapi STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Terlampau banyak stesen bas STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Terlampau banyak ruang punggah lori -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Terlalu hampir dengan stesen/kawasan muatan lain STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Terlalu hampir dengan pelabuhan lain STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Terlalu hampir dengan lapangan terbang lain STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Nama stesen tidak dapat ditukar... diff --git a/src/lang/norwegian_bokmal.txt b/src/lang/norwegian_bokmal.txt index 5d36ea6e3a..f6d1c697e8 100644 --- a/src/lang/norwegian_bokmal.txt +++ b/src/lang/norwegian_bokmal.txt @@ -4227,7 +4227,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}For mang STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}For mange enkeltdeler på jernbanestasjonen STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}For mange bussholdeplasser STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}For mange lasteterminaler -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}For nærme en annen stasjon/lasteterminal STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}For nærme enn annen havn STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}For nærme en annen flyplass STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kan ikke endre stasjonens navn... diff --git a/src/lang/norwegian_nynorsk.txt b/src/lang/norwegian_nynorsk.txt index c36b3b20bb..47e37ed9de 100644 --- a/src/lang/norwegian_nynorsk.txt +++ b/src/lang/norwegian_nynorsk.txt @@ -4119,7 +4119,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}For mang STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}For mange togstasjon-delar STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}For mange busshaldeplassar STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}For mange lasteterminalar -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}For nær ein annan jernbanestasjon/lasteterminal STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}For nær ei anna hamn STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}For nær ein annan flyplass STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kan ikkje endre namnet på stasjonen... diff --git a/src/lang/polish.txt b/src/lang/polish.txt index 84c3ccf026..226b5aa751 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -4621,7 +4621,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Za duzo STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Za dużo części stacji kolejowej STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Zbyt wiele przystanków autobusowych STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Zbyt wiele stacji załadunku ciężarówek -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Zbyt blisko innej stacji/strefy załadunku STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Zbyt blisko innego portu STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Zbyt blisko innego lotniska STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Nie można zmienić nazwy stacji... diff --git a/src/lang/portuguese.txt b/src/lang/portuguese.txt index 3ff52f554e..4755d0b91a 100644 --- a/src/lang/portuguese.txt +++ b/src/lang/portuguese.txt @@ -4223,7 +4223,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Demasiad STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Demasiadas partes na estação ferroviária STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Demasiadas paragens de autocarro STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Demasiadas estações de carga -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Muito junto de uma estação/local de carga STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Muito perto de outra doca STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Demasiado perto de outro aeroporto STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Não pode alterar o nome da estação... diff --git a/src/lang/romanian.txt b/src/lang/romanian.txt index 7648731530..1d88e78f84 100644 --- a/src/lang/romanian.txt +++ b/src/lang/romanian.txt @@ -4157,7 +4157,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Prea mul STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Staţia are prea multe componente STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Prea multe staţii de autobuz STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Prea multe staţii de camion -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Prea aproape de altă staţie STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Prea aproape de alt port STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Prea aproape de un alt aeroport STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Nu se poate redenumi staţia... diff --git a/src/lang/russian.txt b/src/lang/russian.txt index 4598f76dbd..09e0f614ac 100644 --- a/src/lang/russian.txt +++ b/src/lang/russian.txt @@ -4454,7 +4454,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Слиш STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Слишком большая ж/д станция STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Слишком много автобусных остановок STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Слишком много грузовых терминалов -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Слишком близко к другой станции STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Слишком близко к другой пристани STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Слишком близко к другому аэропорту STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Невозможно переименовать станцию... diff --git a/src/lang/serbian.txt b/src/lang/serbian.txt index 3f1ae0df42..cc9cb44b60 100644 --- a/src/lang/serbian.txt +++ b/src/lang/serbian.txt @@ -4445,7 +4445,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Previše STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Previše delova železničke stanice STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Previše autobuskih stanica STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Previše tovarnih stanica -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Previše je blizu druge stanice STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Previše je blizu drugog pristaništa STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Previše je blizu drugog aerodroma STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Ova stanica ne može biti preimenovana... diff --git a/src/lang/simplified_chinese.txt b/src/lang/simplified_chinese.txt index 4bfc987bc0..81f8d67d31 100644 --- a/src/lang/simplified_chinese.txt +++ b/src/lang/simplified_chinese.txt @@ -4216,7 +4216,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}车站 STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}分体站台太多 STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}公共汽车站过多 STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}汽车货场过多 -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}距离另一车站过近 STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}距离另一码头过近 STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}距离另一机场过近 STR_ERROR_CAN_T_RENAME_STATION :{WHITE}不能重命名车站 diff --git a/src/lang/slovak.txt b/src/lang/slovak.txt index 1682291ddd..4edda2d130 100644 --- a/src/lang/slovak.txt +++ b/src/lang/slovak.txt @@ -4271,7 +4271,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Príliš STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Veľa častí vlakovej stanice STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Príliš veľa autobusových zastávok STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Príliš veľa zastávok nákladných automobilov -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Príliš blízko inej stanice/vykládky STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Príliš blízko iného prístavu STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Príliš blízko iného letiska STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Stanica sa nedá premenovať... diff --git a/src/lang/slovenian.txt b/src/lang/slovenian.txt index 119e6b7598..434ec23d70 100644 --- a/src/lang/slovenian.txt +++ b/src/lang/slovenian.txt @@ -4358,7 +4358,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Preveč STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Preveč delov železniške postaje STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Preveč avtobusnih postaj STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Preveč tovornih postaj -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Preblizu druge postaje STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Preblizu drugemu pristanišču STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Preblizu sosednjemu letališču STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Ni mogoče preimenovati postaje diff --git a/src/lang/spanish.txt b/src/lang/spanish.txt index 519d4c7df5..5f706b49f8 100644 --- a/src/lang/spanish.txt +++ b/src/lang/spanish.txt @@ -4223,7 +4223,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Demasiad STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Demasiadas partes de estación de tren STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Demasiadas paradas de autobús STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Demasiadas paradas de camión -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Demasiado cerca de otra estación/zona de carga STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Demasiado cerca de otro muelle STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Demasiado cerca de otro aeropuerto STR_ERROR_CAN_T_RENAME_STATION :{WHITE}No se puede renombrar estación... diff --git a/src/lang/spanish_MX.txt b/src/lang/spanish_MX.txt index 8c4168bcb0..40d54b98d9 100644 --- a/src/lang/spanish_MX.txt +++ b/src/lang/spanish_MX.txt @@ -4282,7 +4282,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Demasiad STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Demasiadas partes de estación de tren STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Demasiadas paradas de autobuses STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Demasiadas estaciones de camiones -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Demasiado cerca de otra estación o zona de carga STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Demasiado cerca de otro muelle STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Demasiado cerca de otro aeropuerto STR_ERROR_CAN_T_RENAME_STATION :{WHITE}No se puede cambiar nombre de la estación... diff --git a/src/lang/swedish.txt b/src/lang/swedish.txt index b71d723945..1602ff8fb5 100644 --- a/src/lang/swedish.txt +++ b/src/lang/swedish.txt @@ -4222,7 +4222,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}För må STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}För många delar på järnvägsstationen STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}För många busshållplatser STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}För många lastbryggor -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}För nära en annan station/hållplats STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}För nära en annan hamn STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}För nära en annan flygplats STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kan inte byta namn på station... diff --git a/src/lang/tamil.txt b/src/lang/tamil.txt index ab7fcf6195..77408ddb0b 100644 --- a/src/lang/tamil.txt +++ b/src/lang/tamil.txt @@ -3757,7 +3757,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}மி STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}மிக அதிகமான இரயில்வே நிலைய பாகங்கள் STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}மிக அதிகமான பேருந்து நிறுத்தங்கள் STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}மிக அதிகமான லாரி நிலையங்கள் -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}மற்றொரு நிலையத்திற்கு மிக அருகில் உள்ளது STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}மற்றொரு துறைமுகத்திற்கு மிக அருகில் உள்ளது STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}மற்றொரு விமான நிலையத்தின் அருகாமையில் உள்ளது STR_ERROR_CAN_T_RENAME_STATION :{WHITE}நிறுத்தத்தின் பெயரை மாற்ற இயலாது... diff --git a/src/lang/thai.txt b/src/lang/thai.txt index cec42d6ff0..03363214b3 100644 --- a/src/lang/thai.txt +++ b/src/lang/thai.txt @@ -4116,7 +4116,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}มี STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}ชิ้นส่วนสถานีมากเกินไป STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}ป้ายรถเมล์มากเกินไป STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}มีจุดขนถ่ายสินค้ามากเกินไป -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}ใกล้กับสถานี/จุดขนถ่ายสินค้าอื่นเกินไป STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}ใกล้กับท่าเทียบเรืออื่นมากเกินไป STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}ใกล้กับท่าอากาศยานอื่นมากเกินไป STR_ERROR_CAN_T_RENAME_STATION :{WHITE}ไม่สามารถเปลี่ยนชื่อได้... diff --git a/src/lang/traditional_chinese.txt b/src/lang/traditional_chinese.txt index 8e646198c0..6eb13007b2 100644 --- a/src/lang/traditional_chinese.txt +++ b/src/lang/traditional_chinese.txt @@ -4203,7 +4203,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}太多 STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}太多火車站元件 STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}太多公車站 STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}太多貨運站 -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}太接近另一個車站/載貨區 STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}太接近另一個碼頭 STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}太接近另一個機場 STR_ERROR_CAN_T_RENAME_STATION :{WHITE}無法修改車站名稱... diff --git a/src/lang/turkish.txt b/src/lang/turkish.txt index 749a5522a8..12cf4c2cb1 100644 --- a/src/lang/turkish.txt +++ b/src/lang/turkish.txt @@ -4223,7 +4223,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Haritada STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Çok fazla demiryolu istasyon parçası var STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Çok fazla durak var STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Çok fazla kamyon yükleme yeri var -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Başka bir istasyona çok yakın STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Başka bir limana çok yakın STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Başka bir havalimanına çok yakın STR_ERROR_CAN_T_RENAME_STATION :{WHITE}İsim değiştirilemiyor... diff --git a/src/lang/ukrainian.txt b/src/lang/ukrainian.txt index 3151d94d98..830d0d544e 100644 --- a/src/lang/ukrainian.txt +++ b/src/lang/ukrainian.txt @@ -4334,7 +4334,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Дуже STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Забагато частин залізничної станції STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Дуже багато зупинок STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Дуже багато вантажних станцій -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Дуже близько до іншої станції STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Дуже близько до іншого порту STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Дуже близько до іншого аеропорту STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Неможливо перейменувати станцію... diff --git a/src/lang/unfinished/frisian.txt b/src/lang/unfinished/frisian.txt index 0a9968ddf4..624eec2f33 100644 --- a/src/lang/unfinished/frisian.txt +++ b/src/lang/unfinished/frisian.txt @@ -3756,7 +3756,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Te folle STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Te folle stasjonsdielen STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Te folle bushaltes STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Te folle frachtstasjons -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Te ticht by in oar stasjon STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Te ticht by in oare haven STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Te ticht by in oar fleanfjild STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Kin namme fan stasjon net feroarje diff --git a/src/lang/unfinished/persian.txt b/src/lang/unfinished/persian.txt index 8bdb86d6d9..26458fd653 100644 --- a/src/lang/unfinished/persian.txt +++ b/src/lang/unfinished/persian.txt @@ -3412,7 +3412,6 @@ STR_ERROR_CAN_T_BUILD_AIRPORT_HERE :{WHITE}نمی STR_ERROR_STATION_TOO_SPREAD_OUT :{WHITE}ایستگاه زیادی پراکنده شده است STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}تعداد محوطه های بارگیری/ایستگاه بسیار زیاد شده -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}به محوطه ی بارگیری/ایستگاه دیگری بسیار نزدیک است STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}به بندر دیگری بسییار نزدیک است STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}به فرودگاه دیگری بسیار نزدیک شده STR_ERROR_CAN_T_RENAME_STATION :{WHITE}نام این ایستگاه را نمی شود تغییر داد diff --git a/src/lang/vietnamese.txt b/src/lang/vietnamese.txt index 31e14b910a..7638a3a983 100644 --- a/src/lang/vietnamese.txt +++ b/src/lang/vietnamese.txt @@ -4281,7 +4281,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Quá nhi STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Quá nhiều mảnh của ga tàu hoả STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Quá nhiều điểm đừng xe buýt STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Quá nhiều trạm bốc dỡ hàng xe tải -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Quá sát với một bến khác STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Quá sát với hải cảng khác STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Quá sát với sân bay khác STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Không thể đổi tên ga, bến,cảng... diff --git a/src/lang/welsh.txt b/src/lang/welsh.txt index 421b3612a2..eb969404e4 100644 --- a/src/lang/welsh.txt +++ b/src/lang/welsh.txt @@ -4222,7 +4222,6 @@ STR_ERROR_TOO_MANY_STATIONS_LOADING :{WHITE}Gormod o STR_ERROR_TOO_MANY_STATION_SPECS :{WHITE}Mae gan yr orsaf ormod o rannau STR_ERROR_TOO_MANY_BUS_STOPS :{WHITE}Gormod o arosfannau bysus STR_ERROR_TOO_MANY_TRUCK_STOPS :{WHITE}Gormod o orsafoedd lorïau -STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION :{WHITE}Rhy agos i orsaf/ardal lwytho STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Rhy agos i ddoc arall STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT :{WHITE}Rhy agos i faes awyr arall STR_ERROR_CAN_T_RENAME_STATION :{WHITE}Methu ailenwi gorsaf... diff --git a/src/linkgraph/demands.cpp b/src/linkgraph/demands.cpp index f4afbabf0a..f1b714820b 100644 --- a/src/linkgraph/demands.cpp +++ b/src/linkgraph/demands.cpp @@ -115,7 +115,6 @@ public: * Check if there is any acceptance left for this node. In asymmetric distribution * nodes always accept as long as their demand > 0. * @param to The node to be checked. - * @param to_anno Unused. */ inline bool HasDemandLeft(const Node &to) { return to.Demand() > 0; } }; diff --git a/src/linkgraph/demands.h b/src/linkgraph/demands.h index c3d9dc7cda..8a639b8b15 100644 --- a/src/linkgraph/demands.h +++ b/src/linkgraph/demands.h @@ -30,7 +30,7 @@ public: /** * Call the demand calculator on the given component. - * @param graph Component to calculate the demands for. + * @param job Component to calculate the demands for. */ virtual void Run(LinkGraphJob &job) const { DemandCalculator c(job); } diff --git a/src/linkgraph/flowmapper.cpp b/src/linkgraph/flowmapper.cpp index feb6be85a9..1aea4a82e6 100644 --- a/src/linkgraph/flowmapper.cpp +++ b/src/linkgraph/flowmapper.cpp @@ -16,7 +16,7 @@ /** * Map the paths generated by the MCF solver into flows associated with nodes. - * @param component the link graph component to be used. + * @param job the link graph component to be used. */ void FlowMapper::Run(LinkGraphJob &job) const { diff --git a/src/linkgraph/linkgraph.cpp b/src/linkgraph/linkgraph.cpp index 50945d361f..34b3a4aa09 100644 --- a/src/linkgraph/linkgraph.cpp +++ b/src/linkgraph/linkgraph.cpp @@ -252,8 +252,6 @@ void LinkGraph::Node::RemoveEdge(NodeID to) * least the given capacity and usage, otherwise add the capacity and usage. * In any case set the respective update timestamp(s), according to the given * mode. - * @param from Start node of the edge. - * @param to End node of the edge. * @param capacity Capacity to be added/updated. * @param usage Usage to be added. * @param mode Update mode to be applied. diff --git a/src/linkgraph/linkgraph_gui.cpp b/src/linkgraph/linkgraph_gui.cpp index 17833615ae..5dcbb51abc 100644 --- a/src/linkgraph/linkgraph_gui.cpp +++ b/src/linkgraph/linkgraph_gui.cpp @@ -581,7 +581,7 @@ LinkGraphLegendWindow::LinkGraphLegendWindow(WindowDesc *desc, int window_number /** * Set the overlay belonging to this menu and import its company/cargo settings. - * @params overlay New overlay for this menu. + * @param overlay New overlay for this menu. */ void LinkGraphLegendWindow::SetOverlay(LinkGraphOverlay *overlay) { this->overlay = overlay; diff --git a/src/linkgraph/mcf.cpp b/src/linkgraph/mcf.cpp index 5db29b1184..3db18c10c4 100644 --- a/src/linkgraph/mcf.cpp +++ b/src/linkgraph/mcf.cpp @@ -210,7 +210,7 @@ public: * Determines if an extension to the given Path with the given parameters is * better than this path. * @param base Other path. - * @param cap Capacity of the new edge to be added to base. + * @param free_cap Capacity of the new edge to be added to base. * @param dist Distance of the new edge. * @return True if base + the new edge would be better than the path associated * with this annotation. @@ -244,7 +244,7 @@ bool DistanceAnnotation::IsBetter(const DistanceAnnotation *base, uint cap, * Determines if an extension to the given Path with the given parameters is * better than this path. * @param base Other path. - * @param cap Capacity of the new edge to be added to base. + * @param free_cap Capacity of the new edge to be added to base. * @param dist Distance of the new edge. * @return True if base + the new edge would be better than the path associated * with this annotation. diff --git a/src/map_type.h b/src/map_type.h index 6c15cd5076..babdbac4a9 100644 --- a/src/map_type.h +++ b/src/map_type.h @@ -73,7 +73,7 @@ static const uint MAX_MAP_TILES = 1 << MAX_MAP_TILES_BITS;///< Maximal numbe * Approximation of the length of a straight track, relative to a diagonal * track (ie the size of a tile side). * - * #defined instead of const so it can + * \#defined instead of const so it can * stay integer. (no runtime float operations) Is this needed? * Watch out! There are _no_ brackets around here, to prevent intermediate * rounding! Be careful when using this! diff --git a/src/misc/dbg_helpers.cpp b/src/misc/dbg_helpers.cpp index a80230de1c..22ccfa3464 100644 --- a/src/misc/dbg_helpers.cpp +++ b/src/misc/dbg_helpers.cpp @@ -117,7 +117,7 @@ void DumpTarget::WriteIndent() } } -/** Write a line with indent at the beginning and at the end. */ +/** Write a line with indent at the beginning and \ at the end. */ void DumpTarget::WriteLine(const char *format, ...) { WriteIndent(); @@ -143,7 +143,7 @@ void DumpTarget::WriteTile(const char *name, TileIndex tile) } /** - * Open new structure (one level deeper than the current one) 'name = {'. + * Open new structure (one level deeper than the current one) 'name = {\'. */ void DumpTarget::BeginStruct(size_t type_id, const char *name, const void *ptr) { @@ -167,7 +167,7 @@ void DumpTarget::BeginStruct(size_t type_id, const char *name, const void *ptr) } /** - * Close structure '}'. + * Close structure '}\'. */ void DumpTarget::EndStruct() { diff --git a/src/misc/getoptdata.h b/src/misc/getoptdata.h index 5982f01fb8..4ce916aa1e 100644 --- a/src/misc/getoptdata.h +++ b/src/misc/getoptdata.h @@ -34,7 +34,7 @@ struct GetOptData { int numleft; ///< Number of arguments left in #argv. char **argv; ///< Remaining command line arguments. const OptionData *options; ///< Command line option descriptions. - char *cont; ///< Next call to #MyGetOpt should start here (in the middle of an argument). + char *cont; ///< Next call to #GetOpt should start here (in the middle of an argument). /** * Constructor of the data store. diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 9918b13af3..0483ab84c9 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -141,6 +141,7 @@ public: DEBUG(misc, LANDINFOD_LEVEL, "m5 = %#x", _m[tile].m5); DEBUG(misc, LANDINFOD_LEVEL, "m6 = %#x", _me[tile].m6); DEBUG(misc, LANDINFOD_LEVEL, "m7 = %#x", _me[tile].m7); + DEBUG(misc, LANDINFOD_LEVEL, "m8 = %#x", _me[tile].m8); #undef LANDINFOD_LEVEL } @@ -774,7 +775,7 @@ struct TooltipsWindow : public Window * @param str String to be displayed * @param paramcount number of params to deal with * @param params (optional) up to 5 pieces of additional information that may be added to a tooltip - * @param use_left_mouse_button close the tooltip when the left (true) or right (false) mouse button is released + * @param close_tooltip when the left (true) or right (false) mouse button is released */ void GuiShowTooltips(Window *parent, StringID str, uint paramcount, const uint64 params[], TooltipCloseCondition close_tooltip) { @@ -1112,7 +1113,7 @@ void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *paren */ struct QueryWindow : public Window { QueryCallbackProc *proc; ///< callback function executed on closing of popup. Window* points to parent, bool is true if 'yes' clicked, false otherwise - uint64 params[10]; ///< local copy of _decode_parameters + uint64 params[10]; ///< local copy of #_global_string_params StringID message; ///< message shown for query window StringID caption; ///< title of window diff --git a/src/music/fluidsynth.cpp b/src/music/fluidsynth.cpp new file mode 100644 index 0000000000..63be1dd99c --- /dev/null +++ b/src/music/fluidsynth.cpp @@ -0,0 +1,157 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file fluidsynth.cpp Playing music via the fluidsynth library. */ + +#include "../stdafx.h" +#include "../openttd.h" +#include "../sound_type.h" +#include "../debug.h" +#include "fluidsynth.h" +#include "midifile.hpp" +#include + +static struct { + fluid_settings_t* settings; ///< FluidSynth settings handle + fluid_synth_t* synth; ///< FluidSynth synthesizer handle + fluid_audio_driver_t* adriver; ///< FluidSynth audio driver handle + fluid_player_t* player; ///< FluidSynth MIDI player handle +} _midi; ///< Metadata about the midi we're playing. + +/** Factory for the FluidSynth driver. */ +static FMusicDriver_FluidSynth iFMusicDriver_FluidSynth; + +/** List of sound fonts to try by default. */ +static const char *default_sf[] = { + /* Debian/Ubuntu/OpenSUSE preferred */ + "/usr/share/sounds/sf2/FluidR3_GM.sf2", + + /* RedHat/Fedora/Arch preferred */ + "/usr/share/soundfonts/FluidR3_GM.sf2", + + /* Debian/Ubuntu/OpenSUSE alternatives */ + "/usr/share/sounds/sf2/TimGM6mb.sf2", + "/usr/share/sounds/sf2/FluidR3_GS.sf2", + + NULL +}; + +const char *MusicDriver_FluidSynth::Start(const char * const *param) +{ + const char *driver_name = GetDriverParam(param, "driver"); + const char *sfont_name = GetDriverParam(param, "soundfont"); + int sfont_id; + + if (!driver_name) driver_name = "alsa"; + + DEBUG(driver, 1, "Fluidsynth: driver %s, sf %s", driver_name, sfont_name); + + /* Create the settings. */ + _midi.settings = new_fluid_settings(); + if (!_midi.settings) return "Could not create midi settings"; + + if (fluid_settings_setstr(_midi.settings, "audio.driver", driver_name) != 1) { + return "Could not set audio driver name"; + } + + /* Create the synthesizer. */ + _midi.synth = new_fluid_synth(_midi.settings); + if (!_midi.synth) return "Could not open synth"; + + /* Create the audio driver. The synthesizer starts playing as soon + as the driver is created. */ + _midi.adriver = new_fluid_audio_driver(_midi.settings, _midi.synth); + if (!_midi.adriver) return "Could not open audio driver"; + + /* Load a SoundFont and reset presets (so that new instruments + * get used from the SoundFont) */ + if (!sfont_name) { + int i; + sfont_id = FLUID_FAILED; + for (i = 0; default_sf[i]; i++) { + if (!fluid_is_soundfont(default_sf[i])) continue; + sfont_id = fluid_synth_sfload(_midi.synth, default_sf[i], 1); + if (sfont_id != FLUID_FAILED) break; + } + if (sfont_id == FLUID_FAILED) return "Could not open any sound font"; + } else { + sfont_id = fluid_synth_sfload(_midi.synth, sfont_name, 1); + if (sfont_id == FLUID_FAILED) return "Could not open sound font"; + } + + _midi.player = NULL; + + return NULL; +} + +void MusicDriver_FluidSynth::Stop() +{ + this->StopSong(); + delete_fluid_audio_driver(_midi.adriver); + delete_fluid_synth(_midi.synth); + delete_fluid_settings(_midi.settings); +} + +void MusicDriver_FluidSynth::PlaySong(const MusicSongInfo &song) +{ + std::string filename = MidiFile::GetSMFFile(song); + + this->StopSong(); + + if (filename.empty()) { + return; + } + + _midi.player = new_fluid_player(_midi.synth); + if (!_midi.player) { + DEBUG(driver, 0, "Could not create midi player"); + return; + } + + if (fluid_player_add(_midi.player, filename.c_str()) != FLUID_OK) { + DEBUG(driver, 0, "Could not open music file"); + delete_fluid_player(_midi.player); + _midi.player = NULL; + return; + } + if (fluid_player_play(_midi.player) != FLUID_OK) { + DEBUG(driver, 0, "Could not start midi player"); + delete_fluid_player(_midi.player); + _midi.player = NULL; + return; + } +} + +void MusicDriver_FluidSynth::StopSong() +{ + if (!_midi.player) return; + + fluid_player_stop(_midi.player); + if (fluid_player_join(_midi.player) != FLUID_OK) { + DEBUG(driver, 0, "Could not join player"); + } + delete_fluid_player(_midi.player); + fluid_synth_system_reset(_midi.synth); + _midi.player = NULL; +} + +bool MusicDriver_FluidSynth::IsSongPlaying() +{ + if (!_midi.player) return false; + + return fluid_player_get_status(_midi.player) == FLUID_PLAYER_PLAYING; +} + +void MusicDriver_FluidSynth::SetVolume(byte vol) +{ + /* Allowed range of synth.gain is 0.0 to 10.0 */ + if (fluid_settings_setnum(_midi.settings, "synth.gain", 1.0 * vol / 128.0) != 1) { + DEBUG(driver, 0, "Could not set volume"); + } +} diff --git a/src/music/fluidsynth.h b/src/music/fluidsynth.h new file mode 100644 index 0000000000..171128a8e9 --- /dev/null +++ b/src/music/fluidsynth.h @@ -0,0 +1,41 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file fluidsynth.h Base for FluidSynth music playback. */ + +#ifndef MUSIC_FLUIDSYNTH_H +#define MUSIC_FLUIDSYNTH_H + +#include "music_driver.hpp" + +/** Music driver making use of FluidSynth. */ +class MusicDriver_FluidSynth : public MusicDriver { +public: + /* virtual */ const char *Start(const char * const *param); + + /* virtual */ void Stop(); + + /* virtual */ void PlaySong(const MusicSongInfo &song); + + /* virtual */ void StopSong(); + + /* virtual */ bool IsSongPlaying(); + + /* virtual */ void SetVolume(byte vol); + /* virtual */ const char *GetName() const { return "fluidsynth"; } +}; + +/** Factory for the fluidsynth driver. */ +class FMusicDriver_FluidSynth : public DriverFactoryBase { +public: + FMusicDriver_FluidSynth() : DriverFactoryBase(Driver::DT_MUSIC, 5, "fluidsynth", "FluidSynth MIDI Driver") {} + /* virtual */ Driver *CreateInstance() const { return new MusicDriver_FluidSynth(); } +}; + +#endif /* MUSIC_FLUIDSYNTH_H */ diff --git a/src/music/midifile.cpp b/src/music/midifile.cpp index a2455358fe..91f83c529d 100644 --- a/src/music/midifile.cpp +++ b/src/music/midifile.cpp @@ -520,8 +520,8 @@ struct MpsMachine { /** * Construct a TTD DOS music format decoder. - * @param songdata Buffer of song data from CAT file, ownership remains with caller - * @param songdatalen Length of the data buffer in bytes + * @param data Buffer of song data from CAT file, ownership remains with caller + * @param length Length of the data buffer in bytes * @param target MidiFile object to add decoded data to */ MpsMachine(const byte *data, size_t length, MidiFile &target) diff --git a/src/music/music_driver.hpp b/src/music/music_driver.hpp index 10a99d2750..f4d3d7dd36 100644 --- a/src/music/music_driver.hpp +++ b/src/music/music_driver.hpp @@ -21,7 +21,7 @@ class MusicDriver : public Driver { public: /** * Play a particular song. - * @param filename The name of file with the song to play. + * @param song The information for the song to play. */ virtual void PlaySong(const MusicSongInfo &song) = 0; diff --git a/src/music_gui.cpp b/src/music_gui.cpp index e7552fe02f..7bf08fd1dc 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -592,7 +592,6 @@ struct MusicTrackSelectionWindow : public Window { break; default: NOT_REACHED(); - break; } } }; diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index 4b1332c589..1df2fc82c4 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -519,7 +519,7 @@ public: * Create the content list window. * @param desc the window description to pass to Window's constructor. * @param select_all Whether the select all button is allowed or not. - * @param type the main type of content to display or #CONTENT_TYPE_END. + * @param types the main type of content to display or #CONTENT_TYPE_END. * When a type other than #CONTENT_TYPE_END is given, dependencies of * other types are only shown when content that depend on them are * selected. diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index 747a7ad67f..07a96d60ef 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -2144,7 +2144,7 @@ bool NetworkCompanyHasClients(CompanyID company) /** - * Get the name of the client, if the user did not send it yet, Client # is used. + * Get the name of the client, if the user did not send it yet, Client ID is used. * @param client_name The variable to write the name to. * @param last The pointer to the last element of the destination buffer */ diff --git a/src/newgrf.cpp b/src/newgrf.cpp index dfab24d755..9429a8368e 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -198,7 +198,7 @@ static GrfProcessingState _cur; /** * Helper to check whether an image index is valid for a particular NewGRF vehicle. - * @param The type of vehicle. + * @tparam T The type of vehicle. * @param image_index The image index to check. * @return True iff the image index is valid, or 0xFD (use new graphics). */ @@ -739,9 +739,9 @@ static void MapSpriteMappingRecolour(PalSpriteID *grf_sprite) * @param invert_action1_flag Set to true, if palette bit 15 means 'not from action 1'. * @param use_cur_spritesets Whether to use currently referenceable action 1 sets. * @param feature GrfSpecFeature to use spritesets from. - * @param [out] grf_sprite Read sprite and palette. - * @param [out] max_sprite_offset Optionally returns the number of sprites in the spriteset of the sprite. (0 if no spritset) - * @param [out] max_palette_offset Optionally returns the number of sprites in the spriteset of the palette. (0 if no spritset) + * @param[out] grf_sprite Read sprite and palette. + * @param[out] max_sprite_offset Optionally returns the number of sprites in the spriteset of the sprite. (0 if no spritset) + * @param[out] max_palette_offset Optionally returns the number of sprites in the spriteset of the palette. (0 if no spritset) * @return Read TileLayoutFlags. */ static TileLayoutFlags ReadSpriteLayoutSprite(ByteReader *buf, bool read_flags, bool invert_action1_flag, bool use_cur_spritesets, int feature, PalSpriteID *grf_sprite, uint16 *max_sprite_offset = NULL, uint16 *max_palette_offset = NULL) @@ -1850,7 +1850,7 @@ static ChangeInfoResult AircraftVehicleChangeInfo(uint engine, int numinfo, int /** * Define properties for stations - * @param stdid StationID of the first station tile. + * @param stid StationID of the first station tile. * @param numinfo Number of subsequent station tiles to change the property for. * @param prop The property to change. * @param buf The property value. @@ -2570,7 +2570,7 @@ static ChangeInfoResult TownHouseChangeInfo(uint hid, int numinfo, int prop, Byt * @param gvid ID of the global variable. This is basically only checked for zerones. * @param numinfo Number of subsequent IDs to change the property for. * @param buf The property value. - * @param [in,out] translation_table Storage location for the translation table. + * @param[in,out] translation_table Storage location for the translation table. * @param name Name of the table for debug output. * @return ChangeInfoResult. */ @@ -3100,6 +3100,10 @@ static ChangeInfoResult IgnoreIndustryTileProperty(int prop, ByteReader *buf) buf->ReadWord(); break; + case 0x13: + buf->Skip(buf->ReadByte() * 2); + break; + default: ret = CIR_UNKNOWN; break; @@ -3189,7 +3193,7 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr case 0x0C: { uint16 acctp = buf->ReadWord(); tsp->accepts_cargo[prop - 0x0A] = GetCargoTranslation(GB(acctp, 0, 8), _cur.grffile); - tsp->acceptance[prop - 0x0A] = GB(acctp, 8, 8); + tsp->acceptance[prop - 0x0A] = Clamp(GB(acctp, 8, 8), 0, 16); break; } @@ -3218,6 +3222,26 @@ static ChangeInfoResult IndustrytilesChangeInfo(uint indtid, int numinfo, int pr tsp->special_flags = (IndustryTileSpecialFlags)buf->ReadByte(); break; + case 0x13: { // variable length cargo acceptance + byte num_cargoes = buf->ReadByte(); + if (num_cargoes > lengthof(tsp->acceptance)) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); + error->param_value[1] = prop; + return CIR_DISABLED; + } + for (uint i = 0; i < lengthof(tsp->acceptance); i++) { + if (i < num_cargoes) { + tsp->accepts_cargo[i] = GetCargoTranslation(buf->ReadByte(), _cur.grffile); + /* Tile acceptance can be negative to counteract the INDTILE_SPECIAL_ACCEPTS_ALL_CARGO flag */ + tsp->acceptance[i] = (int8)buf->ReadByte(); + } else { + tsp->accepts_cargo[i] = CT_INVALID; + tsp->acceptance[i] = 0; + } + } + break; + } + default: ret = CIR_UNKNOWN; break; @@ -3297,11 +3321,17 @@ static ChangeInfoResult IgnoreIndustryProperty(int prop, ByteReader *buf) for (byte j = 0; j < 3; j++) buf->ReadByte(); break; - case 0x15: { - byte number_of_sounds = buf->ReadByte(); - for (uint8 j = 0; j < number_of_sounds; j++) { - buf->ReadByte(); - } + case 0x15: + case 0x25: + case 0x26: + case 0x27: + buf->Skip(buf->ReadByte()); + break; + + case 0x28: { + int num_inputs = buf->ReadByte(); + int num_outputs = buf->ReadByte(); + buf->Skip(num_inputs * num_outputs * 2); break; } @@ -3489,8 +3519,6 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, } else { /* Declared as been valid, can be used */ itt[k].gfx = tempid; - size = k + 1; - copy_from = itt; } } else if (itt[k].gfx == 0xFF) { itt[k].ti.x = (int8)GB(itt[k].ti.x, 0, 8); @@ -3661,6 +3689,77 @@ static ChangeInfoResult IndustriesChangeInfo(uint indid, int numinfo, int prop, break; } + case 0x25: { // variable length produced cargoes + byte num_cargoes = buf->ReadByte(); + if (num_cargoes > lengthof(indsp->produced_cargo)) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); + error->param_value[1] = prop; + return CIR_DISABLED; + } + for (uint i = 0; i < lengthof(indsp->produced_cargo); i++) { + if (i < num_cargoes) { + CargoID cargo = GetCargoTranslation(buf->ReadByte(), _cur.grffile); + indsp->produced_cargo[i] = cargo; + } else { + indsp->produced_cargo[i] = CT_INVALID; + } + } + break; + } + + case 0x26: { // variable length accepted cargoes + byte num_cargoes = buf->ReadByte(); + if (num_cargoes > lengthof(indsp->accepts_cargo)) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); + error->param_value[1] = prop; + return CIR_DISABLED; + } + for (uint i = 0; i < lengthof(indsp->accepts_cargo); i++) { + if (i < num_cargoes) { + CargoID cargo = GetCargoTranslation(buf->ReadByte(), _cur.grffile); + indsp->accepts_cargo[i] = cargo; + } else { + indsp->accepts_cargo[i] = CT_INVALID; + } + } + break; + } + + case 0x27: { // variable length production rates + byte num_cargoes = buf->ReadByte(); + if (num_cargoes > lengthof(indsp->production_rate)) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); + error->param_value[1] = prop; + return CIR_DISABLED; + } + for (uint i = 0; i < lengthof(indsp->production_rate); i++) { + if (i < num_cargoes) { + indsp->production_rate[i] = buf->ReadByte(); + } else { + indsp->production_rate[i] = 0; + } + } + break; + } + + case 0x28: { // variable size input/output production multiplier table + byte num_inputs = buf->ReadByte(); + byte num_outputs = buf->ReadByte(); + if (num_inputs > lengthof(indsp->accepts_cargo) || num_outputs > lengthof(indsp->produced_cargo)) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_LIST_PROPERTY_TOO_LONG); + error->param_value[1] = prop; + return CIR_DISABLED; + } + for (uint i = 0; i < lengthof(indsp->accepts_cargo); i++) { + for (uint j = 0; j < lengthof(indsp->produced_cargo); j++) { + uint16 mult = 0; + if (i < num_inputs && j < num_outputs) mult = buf->ReadWord(); + indsp->input_cargo_multiplier[i][j] = mult; + } + } + break; + } + default: ret = CIR_UNKNOWN; break; @@ -3807,8 +3906,6 @@ static ChangeInfoResult AirportChangeInfo(uint airport, int numinfo, int prop, B } else { /* Declared as been valid, can be used */ att[k].gfx = tempid; - size = k + 1; - copy_from = att; } } else if (att[k].gfx == 0xFF) { att[k].ti.x = (int8)GB(att[k].ti.x, 0, 8); @@ -4863,7 +4960,7 @@ static void NewSpriteGroup(ByteReader *buf) } case GSF_INDUSTRIES: { - if (type > 1) { + if (type > 2) { grfmsg(1, "NewSpriteGroup: Unsupported industry production version %d, skipping", type); break; } @@ -4873,21 +4970,63 @@ static void NewSpriteGroup(ByteReader *buf) act_group = group; group->version = type; if (type == 0) { + group->num_input = 3; for (uint i = 0; i < 3; i++) { group->subtract_input[i] = (int16)buf->ReadWord(); // signed } + group->num_output = 2; for (uint i = 0; i < 2; i++) { group->add_output[i] = buf->ReadWord(); // unsigned } group->again = buf->ReadByte(); - } else { + } else if (type == 1) { + group->num_input = 3; for (uint i = 0; i < 3; i++) { group->subtract_input[i] = buf->ReadByte(); } + group->num_output = 2; for (uint i = 0; i < 2; i++) { group->add_output[i] = buf->ReadByte(); } group->again = buf->ReadByte(); + } else if (type == 2) { + group->num_input = buf->ReadByte(); + if (group->num_input > lengthof(group->subtract_input)) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_INDPROD_CALLBACK); + error->data = stredup("too many inputs (max 16)"); + return; + } + for (uint i = 0; i < group->num_input; i++) { + byte rawcargo = buf->ReadByte(); + CargoID cargo = GetCargoTranslation(rawcargo, _cur.grffile); + if (std::find(group->cargo_input, group->cargo_input + i, cargo) != group->cargo_input + i) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_INDPROD_CALLBACK); + error->data = stredup("duplicate input cargo"); + return; + } + group->cargo_input[i] = cargo; + group->subtract_input[i] = buf->ReadByte(); + } + group->num_output = buf->ReadByte(); + if (group->num_output > lengthof(group->add_output)) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_INDPROD_CALLBACK); + error->data = stredup("too many outputs (max 16)"); + return; + } + for (uint i = 0; i < group->num_output; i++) { + byte rawcargo = buf->ReadByte(); + CargoID cargo = GetCargoTranslation(rawcargo, _cur.grffile); + if (std::find(group->cargo_output, group->cargo_output + i, cargo) != group->cargo_output + i) { + GRFError *error = DisableGrf(STR_NEWGRF_ERROR_INDPROD_CALLBACK); + error->data = stredup("duplicate output cargo"); + return; + } + group->cargo_output[i] = cargo; + group->add_output[i] = buf->ReadByte(); + } + group->again = buf->ReadByte(); + } else { + NOT_REACHED(); } break; } diff --git a/src/newgrf_airport.cpp b/src/newgrf_airport.cpp index 0863d09861..6213097bd0 100644 --- a/src/newgrf_airport.cpp +++ b/src/newgrf_airport.cpp @@ -216,7 +216,6 @@ void AirportOverrideManager::SetEntitySpec(AirportSpec *as) /** * Store a value into the object's persistent storage. - * @param object Object that we want to query. * @param pos Position in the persistent storage to use. * @param value Value to store. */ diff --git a/src/newgrf_animation_base.h b/src/newgrf_animation_base.h index dbe2c53eb4..8d32f6cd4c 100644 --- a/src/newgrf_animation_base.h +++ b/src/newgrf_animation_base.h @@ -31,7 +31,6 @@ template industry); } + case 0x69: + case 0x6A: + case 0x6B: + case 0x6C: + case 0x6D: { + CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile); + int index = this->industry->GetCargoProducedIndex(cargo); + if (index < 0) return 0; // invalid cargo + if (variable == 0x69) return this->industry->produced_cargo_waiting[index]; + if (variable == 0x6A) return this->industry->this_month_production[index]; + if (variable == 0x6B) return this->industry->this_month_transported[index]; + if (variable == 0x6C) return this->industry->last_month_production[index]; + if (variable == 0x6D) return this->industry->last_month_transported[index]; + NOT_REACHED(); + } + + + case 0x6E: + case 0x6F: { + CargoID cargo = GetCargoTranslation(parameter, this->ro.grffile); + int index = this->industry->GetCargoAcceptedIndex(cargo); + if (index < 0) return 0; // invalid cargo + if (variable == 0x6E) return this->industry->last_cargo_accepted_at[index]; + if (variable == 0x6F) return this->industry->incoming_cargo_waiting[index]; + NOT_REACHED(); + } + /* Get a variable from the persistent storage */ case 0x7C: return (this->industry->psa != NULL) ? this->industry->psa->GetValue(parameter) : 0; @@ -364,7 +391,10 @@ static uint32 GetCountAndDistanceOfClosestInstance(byte param_setID, byte layout case 0xB0: return Clamp(this->industry->construction_date - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); // Date when built since 1920 (in days) case 0xB3: return this->industry->construction_type; // Construction type - case 0xB4: return Clamp(this->industry->last_cargo_accepted_at - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); // Date last cargo accepted since 1920 (in days) + case 0xB4: { + Date *latest = std::max_element(this->industry->last_cargo_accepted_at, endof(this->industry->last_cargo_accepted_at)); + return Clamp((*latest) - DAYS_TILL_ORIGINAL_BASE_YEAR, 0, 65535); // Date last cargo accepted since 1920 (in days) + } } DEBUG(grf, 1, "Unhandled industry variable 0x%X", variable); @@ -415,7 +445,7 @@ static const GRFFile *GetGrffile(IndustryType type) /** * Constructor of the industries resolver. * @param tile %Tile owned by the industry. - * @param industry %Industry being resolved. + * @param indus %Industry being resolved. * @param type Type of the industry. * @param random_bits Random bits of the new industry. * @param callback Callback ID. @@ -575,13 +605,28 @@ void IndustryProductionCallback(Industry *ind, int reason) if (tgroup == NULL || tgroup->type != SGT_INDUSTRY_PRODUCTION) break; const IndustryProductionSpriteGroup *group = (const IndustryProductionSpriteGroup *)tgroup; - bool deref = (group->version == 1); + bool deref = (group->version >= 1); - for (uint i = 0; i < 3; i++) { - ind->incoming_cargo_waiting[i] = Clamp(ind->incoming_cargo_waiting[i] - DerefIndProd(group->subtract_input[i], deref) * multiplier, 0, 0xFFFF); - } - for (uint i = 0; i < 2; i++) { - ind->produced_cargo_waiting[i] = Clamp(ind->produced_cargo_waiting[i] + max(DerefIndProd(group->add_output[i], deref), 0) * multiplier, 0, 0xFFFF); + if (group->version < 2) { + /* Callback parameters map directly to industry cargo slot indices */ + for (uint i = 0; i < group->num_input; i++) { + ind->incoming_cargo_waiting[i] = Clamp(ind->incoming_cargo_waiting[i] - DerefIndProd(group->subtract_input[i], deref) * multiplier, 0, 0xFFFF); + } + for (uint i = 0; i < group->num_output; i++) { + ind->produced_cargo_waiting[i] = Clamp(ind->produced_cargo_waiting[i] + max(DerefIndProd(group->add_output[i], deref), 0) * multiplier, 0, 0xFFFF); + } + } else { + /* Callback receives list of cargos to apply for, which need to have their cargo slots in industry looked up */ + for (uint i = 0; i < group->num_input; i++) { + int cargo_index = ind->GetCargoAcceptedIndex(group->cargo_input[i]); + if (cargo_index < 0) continue; + ind->incoming_cargo_waiting[cargo_index] = Clamp(ind->incoming_cargo_waiting[cargo_index] - DerefIndProd(group->subtract_input[i], deref) * multiplier, 0, 0xFFFF); + } + for (uint i = 0; i < group->num_output; i++) { + int cargo_index = ind->GetCargoProducedIndex(group->cargo_output[i]); + if (cargo_index < 0) continue; + ind->produced_cargo_waiting[cargo_index] = Clamp(ind->produced_cargo_waiting[cargo_index] + max(DerefIndProd(group->add_output[i], deref), 0) * multiplier, 0, 0xFFFF); + } } int32 again = DerefIndProd(group->again, deref); @@ -602,7 +647,7 @@ void IndustryProductionCallback(Industry *ind, int reason) */ bool IndustryTemporarilyRefusesCargo(Industry *ind, CargoID cargo_type) { - assert(cargo_type == ind->accepts_cargo[0] || cargo_type == ind->accepts_cargo[1] || cargo_type == ind->accepts_cargo[2]); + assert(std::find(ind->accepts_cargo, endof(ind->accepts_cargo), cargo_type) != endof(ind->accepts_cargo)); const IndustrySpec *indspec = GetIndustrySpec(ind->type); if (HasBit(indspec->callback_mask, CBM_IND_REFUSE_CARGO)) { diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index f1bc27d090..5d88a8be46 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -296,7 +296,7 @@ bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigge * @param tile Industry tile to trigger. * @param trigger Trigger to trigger. * @param ind Industry of the tile. - * @param [in,out] reseed_industry Collects bits to reseed for the industry. + * @param[in,out] reseed_industry Collects bits to reseed for the industry. */ static void DoTriggerIndustryTile(TileIndex tile, IndustryTileTrigger trigger, Industry *ind, uint32 &reseed_industry) { diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index 40a966a166..1501cb9b8a 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -350,8 +350,8 @@ unhandled: * @param tile %Tile of the object. * @param view View of the object. * @param callback Callback ID. - * @param callback_param1 First parameter (var 10) of the callback. - * @param callback_param2 Second parameter (var 18) of the callback. + * @param param1 First parameter (var 10) of the callback. + * @param param2 Second parameter (var 18) of the callback. */ ObjectResolverObject::ObjectResolverObject(const ObjectSpec *spec, Object *obj, TileIndex tile, uint8 view, CallbackID callback, uint32 param1, uint32 param2) diff --git a/src/newgrf_railtype.cpp b/src/newgrf_railtype.cpp index 624b0eca84..8421844717 100644 --- a/src/newgrf_railtype.cpp +++ b/src/newgrf_railtype.cpp @@ -87,8 +87,8 @@ RailTypeResolverObject::RailTypeResolverObject(const RailtypeInfo *rti, TileInde * @param rti The rail type data (spec). * @param tile The tile to get the sprite for. * @param rtsg The type of sprite to draw. - * @param content Where are we drawing the tile? - * @param [out] num_results If not NULL, return the number of sprites in the spriteset. + * @param context Where are we drawing the tile? + * @param[out] num_results If not NULL, return the number of sprites in the spriteset. * @return The sprite to draw. */ SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context, uint *num_results) diff --git a/src/newgrf_spritegroup.cpp b/src/newgrf_spritegroup.cpp index 90ccf7c132..2cf468bf34 100644 --- a/src/newgrf_spritegroup.cpp +++ b/src/newgrf_spritegroup.cpp @@ -119,7 +119,7 @@ static inline uint32 GetVariable(const ResolverObject &object, ScopeResolver *sc /** * Store a value into the persistent storage area (PSA). Default implementation does nothing (for newgrf classes without storage). - * @param pos Position to store into. + * @param reg Position to store into. * @param value Value to store. */ /* virtual */ void ScopeResolver::StorePSA(uint reg, int32 value) {} @@ -145,21 +145,6 @@ static inline uint32 GetVariable(const ResolverObject &object, ScopeResolver *sc return &this->default_scope; } -/** - * Rotate val rot times to the right - * @param val the value to rotate - * @param rot the amount of times to rotate - * @return the rotated value - */ -static uint32 RotateRight(uint32 val, uint32 rot) -{ - /* Do not rotate more than necessary */ - rot %= 32; - - return (val >> rot) | (val << (32 - rot)); -} - - /* Evaluate an adjustment for a variable of the given size. * U is the unsigned type and S is the signed type to use. */ template @@ -192,7 +177,7 @@ static U EvalAdjustT(const DeterministicSpriteGroupAdjust *adjust, ScopeResolver case DSGA_OP_STO: _temp_store.StoreValue((U)value, (S)last_value); return last_value; case DSGA_OP_RST: return value; case DSGA_OP_STOP: scope->StorePSA((U)value, (S)last_value); return last_value; - case DSGA_OP_ROR: return RotateRight(last_value, value); + case DSGA_OP_ROR: return ROR((U)last_value, (U)value & 0x1F); // mask 'value' to 5 bits, which should behave the same on all architectures. case DSGA_OP_SCMP: return ((S)last_value == (S)value) ? 1 : ((S)last_value < (S)value ? 0 : 2); case DSGA_OP_UCMP: return ((U)last_value == (U)value) ? 1 : ((U)last_value < (U)value ? 0 : 2); case DSGA_OP_SHL: return (uint32)(U)last_value << ((U)value & 0x1F); // Same behaviour as in ParamSet, mask 'value' to 5 bits, which should behave the same on all architectures. @@ -360,7 +345,7 @@ const SpriteGroup *RealSpriteGroup::Resolve(ResolverObject &object) const * Process registers and the construction stage into the sprite layout. * The passed construction stage might get reset to zero, if it gets incorporated into the layout * during the preprocessing. - * @param [in, out] stage Construction stage (0-3), or NULL if not applicable. + * @param[in,out] stage Construction stage (0-3), or NULL if not applicable. * @return sprite layout to draw. */ const DrawTileSprites *TileLayoutSpriteGroup::ProcessRegisters(uint8 *stage) const diff --git a/src/newgrf_spritegroup.h b/src/newgrf_spritegroup.h index 6adf7c2ac8..6f038fd138 100644 --- a/src/newgrf_spritegroup.h +++ b/src/newgrf_spritegroup.h @@ -15,6 +15,7 @@ #include "town_type.h" #include "engine_type.h" #include "house_type.h" +#include "industry_type.h" #include "newgrf_callbacks.h" #include "newgrf_generic.h" @@ -277,9 +278,14 @@ struct IndustryProductionSpriteGroup : SpriteGroup { IndustryProductionSpriteGroup() : SpriteGroup(SGT_INDUSTRY_PRODUCTION) {} uint8 version; - int16 subtract_input[3]; // signed - uint16 add_output[2]; // unsigned + uint8 num_input; ///< How many subtract_input values are valid + int16 subtract_input[INDUSTRY_NUM_INPUTS]; ///< Take this much of the input cargo (can be negative, is indirect in cb version 1+) + CargoID cargo_input[INDUSTRY_NUM_INPUTS]; ///< Which input cargoes to take from (only cb version 2) + uint8 num_output; ///< How many add_output values are valid + uint16 add_output[INDUSTRY_NUM_OUTPUTS]; ///< Add this much output cargo when successful (unsigned, is indirect in cb version 1+) + CargoID cargo_output[INDUSTRY_NUM_OUTPUTS]; ///< Which output cargoes to add to (only cb version 2) uint8 again; + }; /** diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index 73015acbf8..4fee303c58 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -883,7 +883,7 @@ bool CanStationTileHaveWires(TileIndex tile) return statspec == NULL || !HasBit(statspec->wires, GetStationGfx(tile)); } -/** Wrapper for animation control, see #GetStationCallback. */ +/** Wrapper for animation control, see GetStationCallback. */ uint16 GetAnimStationCallback(CallbackID callback, uint32 param1, uint32 param2, const StationSpec *statspec, BaseStation *st, TileIndex tile, int extra_data) { return GetStationCallback(callback, param1, param2, statspec, st, tile, INVALID_RAILTYPE); diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 9f741dece4..51844d7dee 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -330,7 +330,7 @@ struct UnmappedChoiceList : ZeroedMemoryAllocator { * @param language_id The (NewGRF) language ID associated with this string. * @param allow_newlines Whether newlines are allowed in the string or not. * @param str The string to translate. - * @param [out] olen The length of the final string. + * @param[out] olen The length of the final string. * @param byte80 The control code to use as replacement for the 0x80-value. * @return The translated string. */ diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 94cfaccf93..71a39eb3a9 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -494,7 +494,7 @@ struct NewsWindow : Window { private: /** - * Moves the window so #newtop is new 'top' coordinate. Makes screen dirty where needed. + * Moves the window to a new #top coordinate. Makes screen dirty where needed. * @param newtop new top coordinate */ void SetWindowTop(int newtop) @@ -962,7 +962,6 @@ void ShowLastNewsMessage() * @param y position of the string * @param colour the colour the string will be shown in * @param *ni NewsItem being printed - * @param maxw maximum width of string in pixels */ static void DrawNewsString(uint left, uint right, int y, TextColour colour, const NewsItem *ni) { diff --git a/src/news_type.h b/src/news_type.h index fee7ae38e3..cad15ecbef 100644 --- a/src/news_type.h +++ b/src/news_type.h @@ -17,19 +17,6 @@ #include "strings_type.h" #include "sound_type.h" -/** Constants in the message options window. */ -enum MessageOptionsSpace { - MOS_WIDG_PER_SETTING = 4, ///< Number of widgets needed for each news category, starting at widget #WID_MO_START_OPTION. - - MOS_LEFT_EDGE = 6, ///< Number of pixels between left edge of the window and the options buttons column. - MOS_COLUMN_SPACING = 4, ///< Number of pixels between the buttons and the description columns. - MOS_RIGHT_EDGE = 6, ///< Number of pixels between right edge of the window and the options descriptions column. - MOS_BUTTON_SPACE = 10, ///< Additional space in the button with the option value (for better looks). - - MOS_ABOVE_GLOBAL_SETTINGS = 6, ///< Number of vertical pixels between the categories and the global options. - MOS_BOTTOM_EDGE = 6, ///< Number of pixels between bottom edge of the window and bottom of the global options. -}; - /** * Type of news. */ diff --git a/src/object_gui.cpp b/src/object_gui.cpp index 57c45d09c9..8aabcfdc46 100644 --- a/src/object_gui.cpp +++ b/src/object_gui.cpp @@ -520,10 +520,7 @@ static WindowDesc _build_object_desc( _nested_build_object_widgets, lengthof(_nested_build_object_widgets) ); -/** - * Show our object picker. - * @param w The toolbar window we're associated with. - */ +/** Show our object picker. */ void ShowBuildObjectPicker() { /* Don't show the place object button when there are no objects to place. */ diff --git a/src/openttd.cpp b/src/openttd.cpp index 6eee54d8eb..82af3f57dd 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -427,6 +427,9 @@ void MakeNewgameSettingsLive() _settings_game.ai_config[c] = NULL; if (_settings_newgame.ai_config[c] != NULL) { _settings_game.ai_config[c] = new AIConfig(_settings_newgame.ai_config[c]); + if (!AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->HasScript()) { + AIConfig::GetConfig(c, AIConfig::SSS_FORCE_GAME)->Change(NULL); + } } } _settings_game.game_config = NULL; @@ -1082,9 +1085,9 @@ static void MakeNewEditorWorld() * Load the specified savegame but on error do different things. * If loading fails due to corrupt savegame, bad version, etc. go back to * a previous correct state. In the menu for example load the intro game again. - * @param mode mode of loading, either SL_LOAD or SL_OLD_LOAD - * @param newgm switch to this mode of loading fails due to some unknown error * @param filename file to be loaded + * @param fop mode of loading, always SLO_LOAD + * @param newgm switch to this mode of loading fails due to some unknown error * @param subdir default directory to look for filename, set to 0 if not needed * @param lf Load filter to use, if NULL: use filename + subdir. */ diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp index 4a566d3d0b..6590771b27 100644 --- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -2295,7 +2295,6 @@ void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist, bool reset_order_indic * Clamp the service interval to the correct min/max. The actual min/max values * depend on whether it's in percent or days. * @param interval proposed service interval - * @param company_id the owner of the vehicle * @return Clamped service interval */ uint16 GetServiceIntervalClamped(uint interval, bool ispercent) diff --git a/src/os/windows/win32.cpp b/src/os/windows/win32.cpp index ef921a28d5..e0434068a0 100644 --- a/src/os/windows/win32.cpp +++ b/src/os/windows/win32.cpp @@ -628,11 +628,11 @@ char *convert_from_fs(const TCHAR *name, char *utf8_buf, size_t buflen) * 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 + * @param system_buf pointer to a valid wide-char buffer that will receive the * converted string * @param buflen length in wide characters of the receiving buffer * @param console_cp convert to the console encoding instead of the normal system encoding. - * @return pointer to utf16_buf. If conversion fails the string is of zero-length + * @return pointer to system_buf. If conversion fails the string is of zero-length */ TCHAR *convert_to_fs(const char *name, TCHAR *system_buf, size_t buflen, bool console_cp) { diff --git a/src/osk_gui.cpp b/src/osk_gui.cpp index 0ebc393def..61eb1d7a00 100644 --- a/src/osk_gui.cpp +++ b/src/osk_gui.cpp @@ -437,9 +437,9 @@ void UpdateOSKOriginalText(const Window *parent, int button) /** * Check whether the OSK is opened for a specific editbox. - * @parent w Window to check for + * @param w Window to check for * @param button Editbox of \a w to check for - * @return true if the OSK is oppened for \a button. + * @return true if the OSK is opened for \a button. */ bool IsOSKOpenedFor(const Window *w, int button) { diff --git a/src/pathfinder/follow_track.hpp b/src/pathfinder/follow_track.hpp index 6c7d50e664..8390b33577 100644 --- a/src/pathfinder/follow_track.hpp +++ b/src/pathfinder/follow_track.hpp @@ -126,8 +126,13 @@ struct CFollowTrackT m_old_tile = old_tile; m_old_td = old_td; m_err = EC_NONE; - assert_tile(((TrackStatusToTrackdirBits(GetTileTrackStatus(m_old_tile, TT(), IsRoadTT() ? RoadVehicle::From(m_veh)->compatible_roadtypes : 0)) & TrackdirToTrackdirBits(m_old_td)) != 0) || - (IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR) || (IsRailTT() && IsRailCustomBridgeHeadTile(m_old_tile)), m_old_td); // Disable the assertion for single tram bits + assert_tile( + ((TrackStatusToTrackdirBits( + GetTileTrackStatus(m_old_tile, TT(), (IsRoadTT() && m_veh != NULL) ? RoadVehicle::From(m_veh)->compatible_roadtypes : 0) + ) & TrackdirToTrackdirBits(m_old_td)) != 0) || + (IsTram() && GetSingleTramBit(m_old_tile) != INVALID_DIAGDIR), // Disable the assertion for single tram bits + m_old_tile + ); m_exitdir = TrackdirToExitdir(m_old_td); if (ForcedReverse()) return true; if (!CanExitOldTile()) return false; diff --git a/src/pathfinder/npf/aystar.cpp b/src/pathfinder/npf/aystar.cpp index 9ef2bca479..8bd63beb7b 100644 --- a/src/pathfinder/npf/aystar.cpp +++ b/src/pathfinder/npf/aystar.cpp @@ -156,7 +156,7 @@ void AyStar::CheckTile(AyStarNode *current, OpenListNode *parent) * his neighbour items. If they are valid, they are added to be checked too. * @return Possible values: * - #AYSTAR_EMPTY_OPENLIST : indicates all items are tested, and no path has been found. - * - #AYSTAR_LIMIT_REACHED : Indicates that the max_nodes limit has been reached. + * - #AYSTAR_LIMIT_REACHED : Indicates that the max_search_nodes limit has been reached. * - #AYSTAR_FOUND_END_NODE : indicates we found the end. Path_found now is true, and in path is the path found. * - #AYSTAR_STILL_BUSY : indicates we have done this tile, did not found the path yet, and have items left to try. */ diff --git a/src/pathfinder/npf/aystar.h b/src/pathfinder/npf/aystar.h index eaa70bf915..4ee9df3329 100644 --- a/src/pathfinder/npf/aystar.h +++ b/src/pathfinder/npf/aystar.h @@ -30,7 +30,7 @@ enum AystarStatus { AYSTAR_EMPTY_OPENLIST, ///< All items are tested, and no path has been found. AYSTAR_STILL_BUSY, ///< Some checking was done, but no path found yet, and there are still items left to try. AYSTAR_NO_PATH, ///< No path to the goal was found. - AYSTAR_LIMIT_REACHED, ///< The #max_nodes limit has been reached, aborting search. + AYSTAR_LIMIT_REACHED, ///< The #AyStar::max_search_nodes limit has been reached, aborting search. AYSTAR_DONE, ///< Not an end-tile, or wrong direction. }; @@ -93,9 +93,9 @@ typedef int32 AyStar_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNod typedef int32 AyStar_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent); /** - * This function requests the tiles around the current tile and put them in #tiles_around. - * #tiles_around is never reset, so if you are not using directions, just leave it alone. - * \warning Never add more tiles_around than memory allocated for it. + * This function requests the tiles around the current tile and put them in #neighbours. + * #neighbours is never reset, so if you are not using directions, just leave it alone. + * @warning Never add more #neighbours than memory allocated for it. */ typedef void AyStar_GetNeighbours(AyStar *aystar, OpenListNode *current); diff --git a/src/pathfinder/opf/opf_ship.cpp b/src/pathfinder/opf/opf_ship.cpp index b14e9efefb..44469e1067 100644 --- a/src/pathfinder/opf/opf_ship.cpp +++ b/src/pathfinder/opf/opf_ship.cpp @@ -155,6 +155,7 @@ static uint FindShipTrack(const Ship *v, TileIndex tile, DiagDirection dir, Trac Track best_track = INVALID_TRACK; + assert(bits != TRACK_BIT_NONE); do { Track i = RemoveFirstTrack(&bits); @@ -186,7 +187,7 @@ good:; best_length = pfs.best_length; bad:; - } while (bits != 0); + } while (bits != TRACK_BIT_NONE); *track = best_track; return best_bird_dist; diff --git a/src/pathfinder/yapf/nodelist.hpp b/src/pathfinder/yapf/nodelist.hpp index e82f869f1e..87e65fd26e 100644 --- a/src/pathfinder/yapf/nodelist.hpp +++ b/src/pathfinder/yapf/nodelist.hpp @@ -25,7 +25,7 @@ template class CNodeList_HashTableT { public: typedef Titem_ Titem; ///< Make #Titem_ visible from outside of class. - typedef typename Titem_::Key Key; ///< Make Titem_::Key a property of #HashTable. + typedef typename Titem_::Key Key; ///< Make Titem_::Key a property of this class. typedef SmallArray CItemArray; ///< Type that we will use as item container. typedef CHashTableT COpenList; ///< How pointers to open nodes will be stored. typedef CHashTableT CClosedList; ///< How pointers to closed nodes will be stored. diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp index 7989450e73..645065f6cc 100644 --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -59,6 +59,8 @@ template void DumpState(Tpf &pf1, Tpf &pf2) FILE *f1 = fopen("yapf1.txt", "wt"); FILE *f2 = fopen("yapf2.txt", "wt"); #endif + assert(f1 != NULL); + assert(f2 != NULL); fwrite(dmp1.m_out.Data(), 1, dmp1.m_out.Size(), f1); fwrite(dmp2.m_out.Data(), 1, dmp2.m_out.Size(), f2); fclose(f1); diff --git a/src/rail.cpp b/src/rail.cpp index d538064a23..1664f78e9a 100644 --- a/src/rail.cpp +++ b/src/rail.cpp @@ -251,7 +251,7 @@ RailTypes AddDateIntroducedRailTypes(RailTypes current, Date date) /** * Get the rail types the given company can build. - * @param c the company to get the rail types for. + * @param company the company to get the rail types for. * @return the rail types. */ RailTypes GetCompanyRailtypes(CompanyID company) diff --git a/src/rail.h b/src/rail.h index d09a076ea2..dcd8daed54 100644 --- a/src/rail.h +++ b/src/rail.h @@ -239,7 +239,7 @@ public: * When #INVALID_DATE or a vehicle using this railtype gets introduced earlier, * the vehicle's introduction date will be used instead for this railtype. * The introduction at this date is furthermore limited by the - * #introduction_required_types. + * #introduction_required_railtypes. */ Date introduction_date; diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 41e42b4276..4b7a312a5d 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -3339,11 +3339,9 @@ int TicksToLeaveDepot(const Train *v) case DIAGDIR_NE: return ((int)(v->x_pos & 0x0F) - ((_fractcoords_enter[dir] & 0x0F) - (length + 1))); case DIAGDIR_SE: return -((int)(v->y_pos & 0x0F) - ((_fractcoords_enter[dir] >> 4) + (length + 1))); case DIAGDIR_SW: return -((int)(v->x_pos & 0x0F) - ((_fractcoords_enter[dir] & 0x0F) + (length + 1))); - default: case DIAGDIR_NW: return ((int)(v->y_pos & 0x0F) - ((_fractcoords_enter[dir] >> 4) - (length + 1))); + default: NOT_REACHED(); } - - return 0; // make compilers happy } /** diff --git a/src/rail_type.h b/src/rail_type.h index ebca7ec35d..2bd602a37e 100644 --- a/src/rail_type.h +++ b/src/rail_type.h @@ -47,9 +47,10 @@ template <> struct EnumPropsT : MakeEnumPropsT RailTypeByte; /** - * The different roadtypes we support, but then a bitmask of them + * The different railtypes we support, but then a bitmask of them. + * @note Must be treated as a uint64 type, narrowing it causes bit membership tests to give wrong results, as in bug #6951. */ -enum RailTypes { +enum RailTypes : uint64 { RAILTYPES_NONE = 0, ///< No rail types RAILTYPES_RAIL = 1 << RAILTYPE_RAIL, ///< Non-electrified rails RAILTYPES_ELECTRIC = 1 << RAILTYPE_ELECTRIC, ///< Electrified rails diff --git a/src/road_func.h b/src/road_func.h index 2943d3159b..2236fdad96 100644 --- a/src/road_func.h +++ b/src/road_func.h @@ -39,7 +39,7 @@ static inline bool IsValidRoadType(RoadType rt) /** * Whether the given roadtype is valid. - * @param rt the roadtype to check for validness + * @param r the roadtype to check for validness * @return true if and only if valid */ static inline bool IsValidRoadBits(RoadBits r) diff --git a/src/road_map.h b/src/road_map.h index 312cb4bb8b..7bc65b4fe1 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -455,6 +455,7 @@ enum Roadside { ROADSIDE_GRASS = 1, ///< Road on grass ROADSIDE_PAVED = 2, ///< Road with paved sidewalks ROADSIDE_STREET_LIGHTS = 3, ///< Road with street lights on paved sidewalks + // 4 is unused for historical reasons ROADSIDE_TREES = 5, ///< Road with trees on paved sidewalks ROADSIDE_GRASS_ROAD_WORKS = 6, ///< Road on grass with road works ROADSIDE_PAVED_ROAD_WORKS = 7, ///< Road with sidewalks and road works diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index b1b3983920..35824251d3 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -256,7 +256,7 @@ void RoadVehUpdateCache(RoadVehicle *v, bool same_length) * @param flags type of operation. * @param e the engine to build. * @param data unused. - * @param ret[out] the vehicle that has been built. + * @param[out] ret the vehicle that has been built. * @return the cost of this operation or an error. */ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret) diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index b5f6ca3152..0e46d6f7b1 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -3308,6 +3308,36 @@ bool AfterLoadGame() t->grow_counter = TownTicksToGameTicks(t->grow_counter) + t->index % TOWN_GROWTH_TICKS; } } + + if (IsSavegameVersionBefore(202)) { + /* Make sure added industry cargo slots are cleared */ + Industry *i; + FOR_ALL_INDUSTRIES(i) { + for (size_t ci = 2; ci < lengthof(i->produced_cargo); ci++) { + i->produced_cargo[ci] = CT_INVALID; + i->produced_cargo_waiting[ci] = 0; + i->production_rate[ci] = 0; + i->last_month_production[ci] = 0; + i->last_month_transported[ci] = 0; + i->last_month_pct_transported[ci] = 0; + i->this_month_production[ci] = 0; + i->this_month_transported[ci] = 0; + } + for (size_t ci = 3; ci < lengthof(i->accepts_cargo); ci++) { + i->accepts_cargo[ci] = CT_INVALID; + i->incoming_cargo_waiting[ci] = 0; + } + /* Make sure last_cargo_accepted_at is copied to elements for every valid input cargo. + * The loading routine should put the original singular value into the first array element. */ + for (size_t ci = 0; ci < lengthof(i->accepts_cargo); ci++) { + if (i->accepts_cargo[ci] != CT_INVALID) { + i->last_cargo_accepted_at[ci] = i->last_cargo_accepted_at[0]; + } else { + i->last_cargo_accepted_at[ci] = 0; + } + } + } + } if (SlXvIsFeatureMissing(XSLFI_TIMETABLES_START_TICKS)) { // savegame timetable start is in days, but we want it in ticks, fix it up diff --git a/src/saveload/industry_sl.cpp b/src/saveload/industry_sl.cpp index 615e8e1522..a9c84e62ab 100644 --- a/src/saveload/industry_sl.cpp +++ b/src/saveload/industry_sl.cpp @@ -26,18 +26,28 @@ static const SaveLoad _industry_desc[] = { SLE_VAR(Industry, location.h, SLE_FILE_U8 | SLE_VAR_U16), SLE_REF(Industry, town, REF_TOWN), SLE_CONDNULL( 2, 0, 60), ///< used to be industry's produced_cargo - SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, 78, SL_MAX_VERSION), - SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, 70, SL_MAX_VERSION), - SLE_ARR(Industry, produced_cargo_waiting, SLE_UINT16, 2), - SLE_ARR(Industry, production_rate, SLE_UINT8, 2), + SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 2, 78, 201), + SLE_CONDARR(Industry, produced_cargo, SLE_UINT8, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 3, 70, 201), + SLE_CONDARR(Industry, incoming_cargo_waiting, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, produced_cargo_waiting, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, production_rate, SLE_UINT8, 2, 0, 201), + SLE_CONDARR(Industry, production_rate, SLE_UINT8, 16, 202, SL_MAX_VERSION), SLE_CONDNULL( 3, 0, 60), ///< used to be industry's accepts_cargo - SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, 78, SL_MAX_VERSION), + SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 3, 78, 201), + SLE_CONDARR(Industry, accepts_cargo, SLE_UINT8, 16, 202, SL_MAX_VERSION), SLE_VAR(Industry, prod_level, SLE_UINT8), - SLE_ARR(Industry, this_month_production, SLE_UINT16, 2), - SLE_ARR(Industry, this_month_transported, SLE_UINT16, 2), - SLE_ARR(Industry, last_month_pct_transported, SLE_UINT8, 2), - SLE_ARR(Industry, last_month_production, SLE_UINT16, 2), - SLE_ARR(Industry, last_month_transported, SLE_UINT16, 2), + SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, this_month_production, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, this_month_transported, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 2, 0, 201), + SLE_CONDARR(Industry, last_month_pct_transported, SLE_UINT8, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, last_month_production, SLE_UINT16, 16, 202, SL_MAX_VERSION), + SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 2, 0, 201), + SLE_CONDARR(Industry, last_month_transported, SLE_UINT16, 16, 202, SL_MAX_VERSION), SLE_VAR(Industry, counter, SLE_UINT16), @@ -51,7 +61,8 @@ static const SaveLoad _industry_desc[] = { SLE_CONDVAR(Industry, founder, SLE_UINT8, 70, SL_MAX_VERSION), SLE_CONDVAR(Industry, construction_date, SLE_INT32, 70, SL_MAX_VERSION), SLE_CONDVAR(Industry, construction_type, SLE_UINT8, 70, SL_MAX_VERSION), - SLE_CONDVAR(Industry, last_cargo_accepted_at, SLE_INT32, 70, SL_MAX_VERSION), + SLE_CONDVAR(Industry, last_cargo_accepted_at[0], SLE_INT32, 70, 201), + SLE_CONDARR(Industry, last_cargo_accepted_at, SLE_INT32, 16, 202, SL_MAX_VERSION), SLE_CONDVAR(Industry, selected_layout, SLE_UINT8, 73, SL_MAX_VERSION), SLEG_CONDARR(_old_ind_persistent_storage.storage, SLE_UINT32, 16, 76, 160), diff --git a/src/saveload/linkgraph_sl.cpp b/src/saveload/linkgraph_sl.cpp index 1076b1fcef..869d2926bc 100644 --- a/src/saveload/linkgraph_sl.cpp +++ b/src/saveload/linkgraph_sl.cpp @@ -140,7 +140,7 @@ static const SaveLoad _edge_desc[] = { /** * Save/load a link graph. - * @param comp Link graph to be saved or loaded. + * @param lg Link graph to be saved or loaded. */ void SaveLoad_LinkGraph(LinkGraph &lg) { diff --git a/src/saveload/oldloader.cpp b/src/saveload/oldloader.cpp index 15e62b8412..d82f21a1fe 100644 --- a/src/saveload/oldloader.cpp +++ b/src/saveload/oldloader.cpp @@ -265,7 +265,7 @@ static SavegameType DetermineOldSavegameType(FILE *f, char *title, const char *l case SGT_TTD: title = strecpy(title, "(TTD) ", last); break; default: title = strecpy(title, "(broken) ", last); break; } - title = strecpy(title, temp, last); + strecpy(title, temp, last); } return type; diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 3fb40bfdb3..c76c790457 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -278,8 +278,9 @@ * 199 * 200 #6805 Extend railtypes to 64, adding uint16 to map array. * 201 #6885 Extend NewGRF persistant storages. + * 202 #6867 Increase industry cargo slots to 16 in, 16 out */ -extern const uint16 SAVEGAME_VERSION = 201; ///< Current savegame version of OpenTTD. +extern const uint16 SAVEGAME_VERSION = 202; ///< Current savegame version of OpenTTD. const uint16 SAVEGAME_VERSION_EXT = 0x8000; ///< Savegame extension indicator mask SavegameType _savegame_type; ///< type of savegame we are loading @@ -3087,7 +3088,7 @@ SaveOrLoadResult LoadWithFilter(LoadFilter *reader) * Main Save or Load function where the high-level saveload functions are * handled. It opens the savegame, selects format and checks versions * @param filename The name of the savegame being created/loaded - * @param mode Save or load mode. Load can also be a TTD(Patch) game. Use #SL_LOAD, #SL_OLD_LOAD, #SL_LOAD_CHECK, or #SL_SAVE. + * @param fop Save or load mode. Load can also be a TTD(Patch) game. * @param sb The sub directory to save the savegame in * @param threaded True when threaded saving is allowed * @return Return the result of the action. #SL_OK, #SL_ERROR, or #SL_REINIT ("unload" the game) diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 77019ebd2c..8c6515dbaf 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -640,7 +640,7 @@ static inline bool SlIsObjectCurrentlyValid(uint16 version_from, uint16 version_ * Get the NumberType of a setting. This describes the integer type * as it is represented in memory * @param type VarType holding information about the variable-type - * @return return the SLE_VAR_* part of a variable-type description + * @return the SLE_VAR_* part of a variable-type description */ static inline VarType GetVarMemType(VarType type) { @@ -648,10 +648,10 @@ static inline VarType GetVarMemType(VarType type) } /** - * Get the #FileType of a setting. This describes the integer type + * Get the FileType of a setting. This describes the integer type * as it is represented in a savegame/file * @param type VarType holding information about the file-type - * @param return the SLE_FILE_* part of a variable-type description + * @return the SLE_FILE_* part of a variable-type description */ static inline VarType GetVarFileType(VarType type) { diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 0605e226c0..f0e2055367 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -711,7 +711,7 @@ static bool MakeSmallScreenshot(bool crashlog) /** * Configure a ViewPort for rendering (a part of) the map into a screenshot. * @param t Screenshot type - * @param [out] vp Result viewport + * @param[out] vp Result viewport */ void SetupScreenshotViewport(ScreenshotType t, ViewPort *vp) { @@ -767,7 +767,7 @@ static bool MakeLargeWorldScreenshot(ScreenshotType t) /** * Callback for generating a heightmap. Supports 8bpp grayscale only. * @param userdata Pointer to user data. - * @param buf Destination buffer. + * @param buffer Destination buffer. * @param y Line number of the first line to write. * @param pitch Number of pixels to write (1 byte for 8bpp, 4 bytes for 32bpp). @see Colour * @param n Number of lines to write. diff --git a/src/script/api/ai/ai_airport.hpp.sq b/src/script/api/ai/ai_airport.hpp.sq index 63ee130981..89e7ba1258 100644 --- a/src/script/api/ai/ai_airport.hpp.sq +++ b/src/script/api/ai/ai_airport.hpp.sq @@ -52,6 +52,7 @@ void SQAIAirport_Register(Squirrel *engine) SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNoiseLevelIncrease, "GetNoiseLevelIncrease", 3, ".ii"); SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNearestTown, "GetNearestTown", 3, ".ii"); SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i"); + SQAIAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMonthlyMaintenanceCost, "GetMonthlyMaintenanceCost", 2, ".i"); SQAIAirport.PostRegister(engine); } diff --git a/src/script/api/ai/ai_station.hpp.sq b/src/script/api/ai/ai_station.hpp.sq index 9248493195..6590c702f3 100644 --- a/src/script/api/ai/ai_station.hpp.sq +++ b/src/script/api/ai/ai_station.hpp.sq @@ -33,7 +33,7 @@ void SQAIStation_Register(Squirrel *engine) SQAIStation.DefSQConst(engine, ScriptStation::STATION_ANY, "STATION_ANY"); ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); - ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); + ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_STATIONS_LOADING, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_TRUCK_STOPS, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_BUS_STOPS, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp index 25e8b3e378..ecb015ed4d 100644 --- a/src/script/api/ai_changelog.hpp +++ b/src/script/api/ai_changelog.hpp @@ -18,6 +18,8 @@ * \b 1.9.0 * * 1.9.0 is not yet released. The following changes are not set in stone yet. + * API additions: + * \li AIAirport::GetMonthlyMaintenanceCost * * \b 1.8.0 * diff --git a/src/script/api/game/game_airport.hpp.sq b/src/script/api/game/game_airport.hpp.sq index cfa99ba377..d8f3a2a64c 100644 --- a/src/script/api/game/game_airport.hpp.sq +++ b/src/script/api/game/game_airport.hpp.sq @@ -52,6 +52,7 @@ void SQGSAirport_Register(Squirrel *engine) SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNoiseLevelIncrease, "GetNoiseLevelIncrease", 3, ".ii"); SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetNearestTown, "GetNearestTown", 3, ".ii"); SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i"); + SQGSAirport.DefSQStaticMethod(engine, &ScriptAirport::GetMonthlyMaintenanceCost, "GetMonthlyMaintenanceCost", 2, ".i"); SQGSAirport.PostRegister(engine); } diff --git a/src/script/api/game/game_station.hpp.sq b/src/script/api/game/game_station.hpp.sq index fa5f98e40c..4c81dee1f7 100644 --- a/src/script/api/game/game_station.hpp.sq +++ b/src/script/api/game/game_station.hpp.sq @@ -33,7 +33,7 @@ void SQGSStation_Register(Squirrel *engine) SQGSStation.DefSQConst(engine, ScriptStation::STATION_ANY, "STATION_ANY"); ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); - ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); + ScriptError::RegisterErrorMap(STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK, ScriptStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION); ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_STATIONS_LOADING, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_TRUCK_STOPS, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); ScriptError::RegisterErrorMap(STR_ERROR_TOO_MANY_BUS_STOPS, ScriptStation::ERR_STATION_TOO_MANY_STATIONS); diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp index 390c1f31ff..7aad75b442 100644 --- a/src/script/api/game_changelog.hpp +++ b/src/script/api/game_changelog.hpp @@ -19,6 +19,7 @@ * * 1.9.0 is not yet released. The following changes are not set in stone yet. * API additions: + * \li GSAirport::GetMonthlyMaintenanceCost * \li GSClient * \li GSClientList * \li GSClientList_Company diff --git a/src/script/api/script_airport.cpp b/src/script/api/script_airport.cpp index f478513ac5..26a67e2773 100644 --- a/src/script/api/script_airport.cpp +++ b/src/script/api/script_airport.cpp @@ -163,3 +163,10 @@ return AirportSpec::Get(type)->maintenance_cost; } + +/* static */ Money ScriptAirport::GetMonthlyMaintenanceCost(AirportType type) +{ + if (!IsAirportInformationAvailable(type)) return -1; + + return (int64)GetMaintenanceCostFactor(type) * _price[PR_INFRASTRUCTURE_AIRPORT] >> 3; +} diff --git a/src/script/api/script_airport.hpp b/src/script/api/script_airport.hpp index e4c0a217d2..6073a2bdd6 100644 --- a/src/script/api/script_airport.hpp +++ b/src/script/api/script_airport.hpp @@ -201,6 +201,14 @@ public: * @return Maintenance cost factor of the airport type. */ static uint16 GetMaintenanceCostFactor(AirportType type); + + /** + * Get the monthly maintenance cost of an airport type. + * @param type The airport type to get the monthly maintenance cost of. + * @pre IsAirportInformationAvailable(type) + * @return Monthly maintenance cost of the airport type. + */ + static Money GetMonthlyMaintenanceCost(AirportType type); }; #endif /* SCRIPT_AIRPORT_HPP */ diff --git a/src/script/api/script_station.hpp b/src/script/api/script_station.hpp index 05a555a30b..6c2a9b32ad 100644 --- a/src/script/api/script_station.hpp +++ b/src/script/api/script_station.hpp @@ -30,7 +30,7 @@ public: ERR_STATION_BASE = ScriptError::ERR_CAT_STATION << ScriptError::ERR_CAT_BIT_SIZE, /** The station is build too close to another station, airport or dock */ - ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION] + ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION, // [STR_ERROR_TOO_CLOSE_TO_ANOTHER_AIRPORT, STR_ERROR_TOO_CLOSE_TO_ANOTHER_DOCK] /** There are too many stations, airports and docks in the game */ ERR_STATION_TOO_MANY_STATIONS, // [STR_ERROR_TOO_MANY_STATIONS_LOADING, STR_ERROR_TOO_MANY_TRUCK_STOPS, STR_ERROR_TOO_MANY_BUS_STOPS, STR_ERROR_TOO_MANY_DOCKS] diff --git a/src/script/script_info_dummy.cpp b/src/script/script_info_dummy.cpp index e11c631512..53860386c1 100644 --- a/src/script/script_info_dummy.cpp +++ b/src/script/script_info_dummy.cpp @@ -92,7 +92,7 @@ void Script_CreateDummy(HSQUIRRELVM vm, StringID string, const char *type) p = newline + 1; } while (newline != NULL); - dp = strecpy(dp, " }\n}\n", lastof(dummy_script)); + strecpy(dp, " }\n}\n", lastof(dummy_script)); /* 3) We translate the error message in the character format that Squirrel wants. * We can use the fact that the wchar string printing also uses %s to print diff --git a/src/settings.cpp b/src/settings.cpp index 86cd8a5f85..c8b9fcb7d4 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1586,7 +1586,7 @@ static int DecodeHexNibble(char c) * Parse a sequence of characters (supposedly hex digits) into a sequence of bytes. * After the hex number should be a \c '|' character. * @param pos First character to convert. - * @param dest [out] Output byte array to write the bytes. + * @param[out] dest Output byte array to write the bytes. * @param dest_size Number of bytes in \a dest. * @return Whether reading was successful. */ @@ -1875,7 +1875,7 @@ void SaveToConfig() /** * Get the list of known NewGrf presets. - * @param list[inout] Pointer to list for storing the preset names. + * @param[in,out] list Pointer to list for storing the preset names. */ void GetGRFPresetList(GRFPresetList *list) { diff --git a/src/settings_type.h b/src/settings_type.h index 7e799e2793..b18307f4c5 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -99,7 +99,7 @@ struct GUISettings { bool smooth_scroll; ///< smooth scroll viewports bool measure_tooltip; ///< show a permanent tooltip when dragging tools byte liveries; ///< options for displaying company liveries, 0=none, 1=self, 2=all - bool prefer_teamchat; ///< choose the chat message target with , true=all clients, false=your team + bool prefer_teamchat; ///< choose the chat message target with \, true=all clients, false=your team uint8 advanced_vehicle_list; ///< use the "advanced" vehicle list uint8 loading_indicators; ///< show loading indicators uint8 default_rail_type; ///< the default rail type for the rail GUI diff --git a/src/settingsgen/settingsgen.cpp b/src/settingsgen/settingsgen.cpp index dd92e2627b..ac6db6581c 100644 --- a/src/settingsgen/settingsgen.cpp +++ b/src/settingsgen/settingsgen.cpp @@ -205,7 +205,6 @@ static const char *DEFAULTS_GROUP_NAME = "defaults"; ///< Name of the group c /** * Load the INI file. * @param filename Name of the file to load. - * @param subdir The subdirectory to load from. * @return Loaded INI data. */ static IniLoadFile *LoadIniFile(const char *filename) @@ -372,7 +371,10 @@ static bool CompareFiles(const char *n1, const char *n2) if (f2 == NULL) return false; FILE *f1 = fopen(n1, "rb"); - if (f1 == NULL) error("can't open %s", n1); + if (f1 == NULL) { + fclose(f2); + error("can't open %s", n1); + } size_t l1, l2; do { @@ -413,12 +415,12 @@ static const OptionData _opts[] = { * After loading, the [pre-amble] group is copied verbatim if it exists. * * For every group with a name that matches a template name the template is written. - * It starts with a optional '#if' line if an 'if' item exists in the group. The item - * value is used as condition. Similarly, '#ifdef' and '#ifndef' lines are also written. + * It starts with a optional \c \#if line if an 'if' item exists in the group. The item + * value is used as condition. Similarly, \c \#ifdef and \c \#ifndef lines are also written. * Below the macro processor directives, the value of the template is written * at a line with its variables replaced by item values of the group being written. * If the group has no item for the variable, the [defaults] group is tried as fall back. - * Finally, '#endif' lines are written to match the macro processor lines. + * Finally, \c \#endif lines are written to match the macro processor lines. * * Last but not least, the [post-amble] group is copied verbatim. * diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 47e84f8fa3..13b2983aa2 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -808,7 +808,7 @@ bool Ship::Tick() * @param flags type of operation. * @param e the engine to build. * @param data unused. - * @param ret[out] the vehicle that has been built. + * @param[out] ret the vehicle that has been built. * @return the cost of this operation or an error. */ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret) diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 283dd01baa..74904af63d 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -323,7 +323,7 @@ void BuildOwnerLegend() /** * Return the colour a tile would be displayed with in the small map in mode "Contour". * @param tile The tile of which we would like to get the colour. - * @param t Effective tile type of the tile (see #GetTileColours). + * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "Contour" */ static inline uint32 GetSmallMapContoursPixels(TileIndex tile, TileType t) @@ -336,7 +336,7 @@ static inline uint32 GetSmallMapContoursPixels(TileIndex tile, TileType t) * Return the colour a tile would be displayed with in the small map in mode "Vehicles". * * @param tile The tile of which we would like to get the colour. - * @param t Effective tile type of the tile (see #GetTileColours). + * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "Vehicles" */ static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile, TileType t) @@ -349,7 +349,7 @@ static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile, TileType t) * Return the colour a tile would be displayed with in the small map in mode "Industries". * * @param tile The tile of which we would like to get the colour. - * @param t Effective tile type of the tile (see #GetTileColours). + * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "Industries" */ static inline uint32 GetSmallMapIndustriesPixels(TileIndex tile, TileType t) @@ -362,7 +362,7 @@ static inline uint32 GetSmallMapIndustriesPixels(TileIndex tile, TileType t) * Return the colour a tile would be displayed with in the small map in mode "Routes". * * @param tile The tile of which we would like to get the colour. - * @param t Effective tile type of the tile (see #GetTileColours). + * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "Routes" */ static inline uint32 GetSmallMapRoutesPixels(TileIndex tile, TileType t) @@ -395,7 +395,7 @@ static inline uint32 GetSmallMapRoutesPixels(TileIndex tile, TileType t) * Return the colour a tile would be displayed with in the small map in mode "link stats". * * @param tile The tile of which we would like to get the colour. - * @param t Effective tile type of the tile (see #GetTileColours). + * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "link stats" */ static inline uint32 GetSmallMapLinkStatsPixels(TileIndex tile, TileType t) @@ -407,7 +407,7 @@ static inline uint32 GetSmallMapLinkStatsPixels(TileIndex tile, TileType t) * Return the colour a tile would be displayed with in the smallmap in mode "Vegetation". * * @param tile The tile of which we would like to get the colour. - * @param t Effective tile type of the tile (see #GetTileColours). + * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the smallmap in mode "Vegetation" */ static inline uint32 GetSmallMapVegetationPixels(TileIndex tile, TileType t) @@ -434,7 +434,7 @@ static inline uint32 GetSmallMapVegetationPixels(TileIndex tile, TileType t) * Return the colour a tile would be displayed with in the small map in mode "Owner". * * @param tile The tile of which we would like to get the colour. - * @param t Effective tile type of the tile (see #GetTileColours). + * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the small map in mode "Owner" */ static inline uint32 GetSmallMapOwnerPixels(TileIndex tile, TileType t) @@ -517,7 +517,7 @@ inline Point SmallMapWindow::RemapTile(int tile_x, int tile_y) const * that tile for a point in the smallmap. * @param px Horizontal coordinate of the pixel. * @param py Vertical coordinate of the pixel. - * @param sub[out] Pixel position at the tile (0..3). + * @param[out] sub Pixel position at the tile (0..3). * @param add_sub Add current #subscroll to the position. * @return Tile being displayed at the given position relative to #scroll_x and #scroll_y. * @note The #subscroll offset is already accounted for. @@ -547,11 +547,11 @@ inline Point SmallMapWindow::PixelToTile(int px, int py, int *sub, bool add_sub) /** * Compute base parameters of the smallmap such that tile (\a tx, \a ty) starts at pixel (\a x, \a y). - * @param tx Tile x coordinate. - * @param ty Tile y coordinate. - * @param x Non-negative horizontal position in the display where the tile starts. - * @param y Non-negative vertical position in the display where the tile starts. - * @param sub [out] Value of #subscroll needed. + * @param tx Tile x coordinate. + * @param ty Tile y coordinate. + * @param x Non-negative horizontal position in the display where the tile starts. + * @param y Non-negative vertical position in the display where the tile starts. + * @param[out] sub Value of #subscroll needed. * @return #scroll_x, #scroll_y values. */ Point SmallMapWindow::ComputeScroll(int tx, int ty, int x, int y, int *sub) diff --git a/src/station_base.h b/src/station_base.h index 4eef69dea2..b4523ca78f 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -529,7 +529,7 @@ private: public: /** * Construct the iterator. - * @param ta Area, i.e. begin point and width/height of to-be-iterated area. + * @param st Station the airport is part of. */ AirportTileIterator(const Station *st) : OrthogonalTileIterator(st->airport), st(st) { diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 3dac4d04ba..f685e70bc5 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -91,25 +91,25 @@ bool IsHangar(TileIndex t) } /** - * Look for a station around the given tile area. + * Look for a station owned by the given company around the given tile area. * @param ta the area to search over - * @param closest_station the closest station found so far + * @param closest_station the closest owned station found so far + * @param company the company whose stations to look for * @param st to 'return' the found station * @return Succeeded command (if zero or one station found) or failed command (for two or more stations found). */ template -CommandCost GetStationAround(TileArea ta, StationID closest_station, T **st) +CommandCost GetStationAround(TileArea ta, StationID closest_station, CompanyID company, T **st) { ta.tile -= TileDiffXY(1, 1); ta.w += 2; ta.h += 2; - /* check around to see if there's any stations there */ + /* check around to see if there are any stations there owned by the company */ TILE_AREA_LOOP(tile_cur, ta) { if (IsTileType(tile_cur, MP_STATION)) { StationID t = GetStationIndex(tile_cur); - if (!T::IsValidID(t)) continue; - + if (!T::IsValidID(t) || Station::Get(t)->owner != company) continue; if (closest_station == INVALID_STATION) { closest_station = t; } else if (closest_station != t) { @@ -664,7 +664,7 @@ static void UpdateStationSignCoord(BaseStation *st) /** * Common part of building various station parts and possibly attaching them to an existing one. - * @param [in,out] st Station to attach to + * @param[in,out] st Station to attach to * @param flags Command flags * @param reuse Whether to try to reuse a deleted station (gray sign) if possible * @param area Area occupied by the new part @@ -678,7 +678,7 @@ static CommandCost BuildStationPart(Station **st, DoCommandFlag flags, bool reus if (*st != NULL) { if ((*st)->owner != _current_company) { - return_cmd_error(STR_ERROR_TOO_CLOSE_TO_ANOTHER_STATION); + return_cmd_error(CMD_ERROR); } CommandCost ret = (*st)->rect.BeforeAddRect(area.tile, area.w, area.h, StationRect::ADD_TEST); @@ -1139,8 +1139,8 @@ CommandCost FindJoiningBaseStation(StationID existing_station, StationID station } if (check_surrounding) { - /* Make sure there are no similar stations around us. */ - CommandCost ret = GetStationAround(ta, existing_station, st); + /* Make sure there is no more than one other station around us that is owned by us. */ + CommandCost ret = GetStationAround(ta, existing_station, _current_company, st); if (ret.Failed()) return ret; } @@ -2789,9 +2789,9 @@ const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx) * Check whether a sprite is a track sprite, which can be replaced by a non-track ground sprite and a rail overlay. * If the ground sprite is suitable, \a ground is replaced with the new non-track ground sprite, and \a overlay_offset * is set to the overlay to draw. - * @param ti Positional info for the tile to decide snowyness etc. May be NULL. - * @param [in,out] ground Groundsprite to draw. - * @param [out] overlay_offset Overlay to draw. + * @param ti Positional info for the tile to decide snowyness etc. May be NULL. + * @param[in,out] ground Groundsprite to draw. + * @param[out] overlay_offset Overlay to draw. * @return true if overlay can be drawn. */ bool SplitGroundSpriteForOverlay(const TileInfo *ti, SpriteID *ground, RailTrackOffset *overlay_offset) diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 0a3439c24b..2fb74dcfb9 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -806,7 +806,6 @@ static const NWidgetPart _nested_station_view_widgets[] = { * @param left left most coordinate to draw on * @param right right most coordinate to draw on * @param y y coordinate - * @param width the width of the view */ static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y) { diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index fa29424658..c231717dac 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -215,7 +215,10 @@ bool CompareFiles(const char *n1, const char *n2) if (f2 == NULL) return false; FILE *f1 = fopen(n1, "rb"); - if (f1 == NULL) error("can't open %s", n1); + if (f1 == NULL) { + fclose(f2); + error("can't open %s", n1); + } size_t l1, l2; do { diff --git a/src/strgen/strgen_base.cpp b/src/strgen/strgen_base.cpp index 385ca72b2a..8d46b1b271 100644 --- a/src/strgen/strgen_base.cpp +++ b/src/strgen/strgen_base.cpp @@ -85,7 +85,7 @@ void LangString::FreeTranslation() /** * Create a new string data container. - * @param max_strings The maximum number of strings. + * @param tabs The maximum number of strings. */ StringData::StringData(size_t tabs) : tabs(tabs), max_strings(tabs * TAB_SIZE) { diff --git a/src/string.cpp b/src/string.cpp index 2afe86776a..23267f8bf9 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -176,7 +176,7 @@ void str_fix_scc_encoded(char *str, const char *last) if ((len == 0 && str + 4 > last) || str + len > last) break; WChar c; - len = Utf8Decode(&c, str); + Utf8Decode(&c, str); if (c == '\0') break; if (c == 0xE028 || c == 0xE02A) { @@ -406,9 +406,8 @@ bool IsValidChar(WChar key, CharSetFilter afilter) case CS_NUMERAL_SPACE: return (key >= '0' && key <= '9') || key == ' '; case CS_ALPHA: return IsPrintable(key) && !(key >= '0' && key <= '9'); case CS_HEXADECIMAL: return (key >= '0' && key <= '9') || (key >= 'a' && key <= 'f') || (key >= 'A' && key <= 'F'); + default: NOT_REACHED(); } - - return false; } #ifdef WIN32 diff --git a/src/string_base.h b/src/string_base.h index e1eaed3496..02856cf1c6 100644 --- a/src/string_base.h +++ b/src/string_base.h @@ -41,9 +41,9 @@ public: /** * Change the current string cursor. - * @param p New cursor position. + * @param pos New cursor position. * @return Actual new cursor position at the next valid character boundary. - * @pre p has to be inside the current string. + * @pre pos has to be inside the current string. */ virtual size_t SetCurPosition(size_t pos) = 0; diff --git a/src/strings.cpp b/src/strings.cpp index 12536bb711..d8ed82eaea 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -58,7 +58,7 @@ icu::Collator *_current_collator = NULL; ///< Collator for the language #endif /* WITH_ICU_SORT */ static uint64 _global_string_params_data[20]; ///< Global array of string parameters. To access, use #SetDParam. -static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_decode_parameters +static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_global_string_params StringParameters _global_string_params(_global_string_params_data, 20, _global_string_params_type); /** Reset the type array. */ @@ -949,11 +949,10 @@ uint ConvertDisplayToForceWeightRatio(double in) /** * Parse most format codes within a string and write the result to a buffer. - * @param buff The buffer to write the final string to. - * @param str The original string with format codes. - * @param args Pointer to extra arguments used by various string codes. - * @param case_index - * @param last Pointer to just past the end of the buff array. + * @param buff The buffer to write the final string to. + * @param str_arg The original string with format codes. + * @param args Pointer to extra arguments used by various string codes. + * @param last Pointer to just past the end of the buff array. * @param dry_run True when the argt array is not yet initialized. */ static char *FormatString(char *buff, const char *str_arg, StringParameters *args, const char *last, uint case_index, bool game_script, bool dry_run) @@ -1008,7 +1007,6 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg sub_args.ClearTypeInformation(); memset(sub_args_need_free, 0, sizeof(sub_args_need_free)); - const char *s = str; char *p; uint32 stringid = strtoul(str, &p, 16); if (*p != ':' && *p != '\0') { @@ -1027,7 +1025,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg int i = 0; while (*p != '\0' && i < 20) { uint64 param; - s = ++p; + const char *s = ++p; /* Find the next value */ bool instring = false; @@ -2264,7 +2262,7 @@ const char *GetCurrentLanguageIsoCode() /** * Check whether there are glyphs missing in the current language. - * @param Pointer to an address for storing the text pointer. + * @param[out] str Pointer to an address for storing the text pointer. * @return If glyphs are missing, return \c true, else return \c false. * @post If \c true is returned and str is not NULL, *str points to a string that is found to contain at least one missing glyph. */ diff --git a/src/subsidy.cpp b/src/subsidy.cpp index bd2ed07be5..d1fda0f0ac 100644 --- a/src/subsidy.cpp +++ b/src/subsidy.cpp @@ -383,15 +383,21 @@ bool FindSubsidyIndustryCargoRoute() CargoID cid; /* Randomize cargo type */ - if (src_ind->produced_cargo[1] != CT_INVALID && HasBit(Random(), 0)) { - cid = src_ind->produced_cargo[1]; - trans = src_ind->last_month_pct_transported[1]; - total = src_ind->last_month_production[1]; - } else { - cid = src_ind->produced_cargo[0]; - trans = src_ind->last_month_pct_transported[0]; - total = src_ind->last_month_production[0]; + int num_cargos = 0; + uint cargo_index; + for (cargo_index = 0; cargo_index < lengthof(src_ind->produced_cargo); cargo_index++) { + if (src_ind->produced_cargo[cargo_index] != CT_INVALID) num_cargos++; } + if (num_cargos == 0) return false; // industry produces nothing + int cargo_num = RandomRange(num_cargos) + 1; + for (cargo_index = 0; cargo_index < lengthof(src_ind->produced_cargo); cargo_index++) { + if (src_ind->produced_cargo[cargo_index] != CT_INVALID) cargo_num--; + if (cargo_num == 0) break; + } + assert(cargo_num == 0); // indicates loop didn't break as intended + cid = src_ind->produced_cargo[cargo_index]; + trans = src_ind->last_month_pct_transported[cargo_index]; + total = src_ind->last_month_production[cargo_index]; /* Quit if no production in this industry * or if the pct transported is already large enough @@ -435,14 +441,11 @@ bool FindSubsidyCargoDestination(CargoID cid, SourceType src_type, SourceID src) case ST_INDUSTRY: { /* Select a random industry. */ const Industry *dst_ind = Industry::GetRandom(); + if (dst_ind == NULL) return false; /* The industry must accept the cargo */ - if (dst_ind == NULL || - (cid != dst_ind->accepts_cargo[0] && - cid != dst_ind->accepts_cargo[1] && - cid != dst_ind->accepts_cargo[2])) { - return false; - } + bool valid = std::find(dst_ind->accepts_cargo, endof(dst_ind->accepts_cargo), cid) != endof(dst_ind->accepts_cargo); + if (!valid) return false; dst = dst_ind->index; break; diff --git a/src/table/build_industry.h b/src/table/build_industry.h index a0783332ef..62264eb6f8 100644 --- a/src/table/build_industry.h +++ b/src/table/build_industry.h @@ -1195,8 +1195,12 @@ enum IndustryTypes { #define MI(tbl, sndc, snd, d, pc, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col, \ c1, c2, c3, proc, p1, r1, p2, r2, m, a1, im1, a2, im2, a3, im3, pr, clim, bev, in, intx, s1, s2, s3) \ - {tbl, lengthof(tbl), d, 0, pc, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \ - {a1, a2, a3}, {{im1, 0}, {im2, 0}, {im3, 0}}, pr, clim, bev, col, in, intx, s1, s2, s3, STR_UNDEFINED, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \ + {tbl, lengthof(tbl), d, 0, pc, {c1, c2, c3}, proc, \ + {p1, p2, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID}, \ + {r1, r2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, m, \ + {a1, a2, a3, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID}, \ + {{im1, 0}, {im2, 0}, {im3, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}}, \ + pr, clim, bev, col, in, intx, s1, s2, s3, STR_UNDEFINED, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \ sndc, snd, 0, 0, true, GRFFileProps(INVALID_INDUSTRYTYPE)} /* Format: tile table count and sounds table @@ -1594,7 +1598,7 @@ static const IndustrySpec _origin_industry_specs[NEW_INDUSTRYOFFSET] = { * @param a2 next frame of animation * @param a3 chooses between animation or construction state */ -#define MT(ca1, c1, ca2, c2, ca3, c3, sl, a1, a2, a3) {{c1, c2, c3}, {ca1, ca2, ca3}, sl, a1, a2, a3, 0, {0, ANIM_STATUS_NO_ANIMATION, 2, 0}, INDTILE_SPECIAL_NONE, true, GRFFileProps(INVALID_INDUSTRYTILE)} +#define MT(ca1, c1, ca2, c2, ca3, c3, sl, a1, a2, a3) {{c1, c2, c3, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID, CT_INVALID}, {ca1, ca2, ca3}, sl, a1, a2, a3, 0, {0, ANIM_STATUS_NO_ANIMATION, 2, 0}, INDTILE_SPECIAL_NONE, true, GRFFileProps(INVALID_INDUSTRYTILE)} static const IndustryTileSpec _origin_industry_tile_specs[NEW_INDUSTRYTILEOFFSET] = { /* Coal Mine */ MT(0, CT_INVALID, 0, CT_INVALID, 0, CT_INVALID, SLOPE_STEEP, INDUSTRYTILE_NOANIM, INDUSTRYTILE_NOANIM, false), diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 253f88c7a3..e737259872 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -286,11 +286,38 @@ static const NIFeature _nif_industrytile = { /*** NewGRF industries ***/ static const NIProperty _nip_industries[] = { - NIP(0x10, Industry, produced_cargo[0], NIT_CARGO, "produced cargo 0"), - NIP(0x10, Industry, produced_cargo[1], NIT_CARGO, "produced cargo 1"), - NIP(0x11, Industry, accepts_cargo[0], NIT_CARGO, "accepted cargo 0"), - NIP(0x11, Industry, accepts_cargo[1], NIT_CARGO, "accepted cargo 1"), - NIP(0x11, Industry, accepts_cargo[2], NIT_CARGO, "accepted cargo 2"), + NIP(0x25, Industry, produced_cargo[ 0], NIT_CARGO, "produced cargo 0"), + NIP(0x25, Industry, produced_cargo[ 1], NIT_CARGO, "produced cargo 1"), + NIP(0x25, Industry, produced_cargo[ 2], NIT_CARGO, "produced cargo 2"), + NIP(0x25, Industry, produced_cargo[ 3], NIT_CARGO, "produced cargo 3"), + NIP(0x25, Industry, produced_cargo[ 4], NIT_CARGO, "produced cargo 4"), + NIP(0x25, Industry, produced_cargo[ 5], NIT_CARGO, "produced cargo 5"), + NIP(0x25, Industry, produced_cargo[ 6], NIT_CARGO, "produced cargo 6"), + NIP(0x25, Industry, produced_cargo[ 7], NIT_CARGO, "produced cargo 7"), + NIP(0x25, Industry, produced_cargo[ 8], NIT_CARGO, "produced cargo 8"), + NIP(0x25, Industry, produced_cargo[ 9], NIT_CARGO, "produced cargo 9"), + NIP(0x25, Industry, produced_cargo[10], NIT_CARGO, "produced cargo 10"), + NIP(0x25, Industry, produced_cargo[11], NIT_CARGO, "produced cargo 11"), + NIP(0x25, Industry, produced_cargo[12], NIT_CARGO, "produced cargo 12"), + NIP(0x25, Industry, produced_cargo[13], NIT_CARGO, "produced cargo 13"), + NIP(0x25, Industry, produced_cargo[14], NIT_CARGO, "produced cargo 14"), + NIP(0x25, Industry, produced_cargo[15], NIT_CARGO, "produced cargo 15"), + NIP(0x26, Industry, accepts_cargo[ 0], NIT_CARGO, "accepted cargo 0"), + NIP(0x26, Industry, accepts_cargo[ 1], NIT_CARGO, "accepted cargo 1"), + NIP(0x26, Industry, accepts_cargo[ 2], NIT_CARGO, "accepted cargo 2"), + NIP(0x26, Industry, accepts_cargo[ 3], NIT_CARGO, "accepted cargo 3"), + NIP(0x26, Industry, accepts_cargo[ 4], NIT_CARGO, "accepted cargo 4"), + NIP(0x26, Industry, accepts_cargo[ 5], NIT_CARGO, "accepted cargo 5"), + NIP(0x26, Industry, accepts_cargo[ 6], NIT_CARGO, "accepted cargo 6"), + NIP(0x26, Industry, accepts_cargo[ 7], NIT_CARGO, "accepted cargo 7"), + NIP(0x26, Industry, accepts_cargo[ 8], NIT_CARGO, "accepted cargo 8"), + NIP(0x26, Industry, accepts_cargo[ 9], NIT_CARGO, "accepted cargo 9"), + NIP(0x26, Industry, accepts_cargo[10], NIT_CARGO, "accepted cargo 10"), + NIP(0x26, Industry, accepts_cargo[11], NIT_CARGO, "accepted cargo 11"), + NIP(0x26, Industry, accepts_cargo[12], NIT_CARGO, "accepted cargo 12"), + NIP(0x26, Industry, accepts_cargo[13], NIT_CARGO, "accepted cargo 13"), + NIP(0x26, Industry, accepts_cargo[14], NIT_CARGO, "accepted cargo 14"), + NIP(0x26, Industry, accepts_cargo[15], NIT_CARGO, "accepted cargo 15"), NIP_END() }; diff --git a/src/textbuf.cpp b/src/textbuf.cpp index 3d219e916d..61e449d3ae 100644 --- a/src/textbuf.cpp +++ b/src/textbuf.cpp @@ -367,7 +367,6 @@ bool Textbuf::MovePos(uint16 keycode) /** * Initialize the textbuffer by supplying it the buffer to write into * and the maximum length of this buffer - * @param buf the buffer that will be holding the data for input * @param max_bytes maximum size in bytes, including terminating '\0' * @param max_chars maximum size in chars, including terminating '\0' */ diff --git a/src/tile_map.cpp b/src/tile_map.cpp index c566ad02cd..d73beeb886 100644 --- a/src/tile_map.cpp +++ b/src/tile_map.cpp @@ -70,11 +70,11 @@ uint TileHeightOutsideMap(int x, int y) /** * Get a tile's slope given the heigh of its four corners. - * @param hnorth The height at the northern corner in the same unit as TileHeight. - * @param hwest The height at the western corner in the same unit as TileHeight. - * @param heast The height at the eastern corner in the same unit as TileHeight. - * @param hsouth The height at the southern corner in the same unit as TileHeight. - * @param [out] h The lowest height of the four corners. + * @param hnorth The height at the northern corner in the same unit as TileHeight. + * @param hwest The height at the western corner in the same unit as TileHeight. + * @param heast The height at the eastern corner in the same unit as TileHeight. + * @param hsouth The height at the southern corner in the same unit as TileHeight. + * @param[out] h The lowest height of the four corners. * @return The slope. */ static Slope GetTileSlopeGivenHeight(int hnorth, int hwest, int heast, int hsouth, int *h) @@ -134,7 +134,8 @@ Slope GetTileSlope(TileIndex tile, int *h) /** * Return the slope of a given tile outside the map. * - * @param tile Tile outside the map to compute slope of. + * @param x X-coordinate of the tile outside to compute height of. + * @param y Y-coordinate of the tile outside to compute height of. * @param h If not \c NULL, pointer to storage of z height. * @return Slope of the tile outside map, except for the HALFTILE part. */ @@ -194,7 +195,8 @@ int GetTileZ(TileIndex tile) /** * Get bottom height of the tile outside map. * - * @param tile Tile outside the map to compute height of. + * @param x X-coordinate of the tile outside to compute height of. + * @param y Y-coordinate of the tile outside to compute height of. * @return Minimum height of the tile outside the map. */ int GetTilePixelZOutsideMap(int x, int y) @@ -229,7 +231,8 @@ int GetTileMaxZ(TileIndex t) * * @see Detailed description in header. * - * @param tile Tile outside to compute height of. + * @param x X-coordinate of the tile outside to compute height of. + * @param y Y-coordinate of the tile outside to compute height of. * @return Maximum height of the tile. */ int GetTileMaxPixelZOutsideMap(int x, int y) diff --git a/src/tile_map.h b/src/tile_map.h index 2bed3aa66f..372909a93d 100644 --- a/src/tile_map.h +++ b/src/tile_map.h @@ -291,7 +291,7 @@ int GetTilePixelZOutsideMap(int x, int y); /** * Get top height of the tile - * @param t Tile to compute height of + * @param tile Tile to compute height of * @return Maximum height of the tile */ static inline int GetTileMaxPixelZ(TileIndex tile) diff --git a/src/tilematrix_type.hpp b/src/tilematrix_type.hpp index 56f2541438..f9c7392b24 100644 --- a/src/tilematrix_type.hpp +++ b/src/tilematrix_type.hpp @@ -87,7 +87,7 @@ public: /** * Get the area of the matrix square that contains a specific tile. - * @param The tile to get the map area for. + * @param tile The tile to get the map area for. * @param extend Extend the area by this many squares on all sides. * @return Tile area containing the tile. */ diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp index 00526e8033..525dcea58d 100644 --- a/src/timetable_gui.cpp +++ b/src/timetable_gui.cpp @@ -163,7 +163,7 @@ static void ChangeTimetableStartIntl(uint32 p1, DateTicksScaled date) /** * Callback for when a time has been chosen to start the time table - * @param window the window related to the setting of the date + * @param w the window related to the setting of the date * @param date the actually chosen date */ static void ChangeTimetableStartCallback(const Window *w, DateTicksScaled date) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 7cb58b339a..2f766224fe 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -884,7 +884,7 @@ void UpdateTownCargoTotal(Town *t) static void UpdateTownCargoes(Town *t, TileIndex start, bool update_total = true) { CargoArray accepted, produced; - CargoTypes dummy; + CargoTypes dummy = 0; /* Gather acceptance for all houses in an area around the start tile. * The area is composed of the square the tile is in, extended one square in all @@ -3401,7 +3401,7 @@ static void UpdateTownRating(Town *t) /** * Updates town grow counter after growth rate change. * Preserves relative house builting progress whenever it can. - * @param town The town to calculate grow counter for + * @param t The town to calculate grow counter for * @param prev_growth_rate Town growth rate before it changed (one that was used with grow counter to be updated) */ static void UpdateTownGrowCounter(Town *t, uint16 prev_growth_rate) @@ -3416,7 +3416,7 @@ static void UpdateTownGrowCounter(Town *t, uint16 prev_growth_rate) /** * Calculates amount of active stations in the range of town (HZB_TOWN_EDGE). - * @param town The town to calculate stations for + * @param t The town to calculate stations for * @returns Amount of active stations */ static int CountActiveStations(Town *t) @@ -3436,7 +3436,7 @@ static int CountActiveStations(Town *t) /** * Calculates town growth rate in normal conditions (custom growth rate not set). * If town growth speed is set to None(0) returns the same rate as if it was Normal(2). - * @param town The town to calculate growth rate for + * @param t The town to calculate growth rate for * @returns Calculated growth rate */ static uint GetNormalGrowthRate(Town *t) @@ -3486,7 +3486,7 @@ static uint GetNormalGrowthRate(Town *t) /** * Updates town growth rate. - * @param town The town to update growth rate for + * @param t The town to update growth rate for */ static void UpdateTownGrowthRate(Town *t) { @@ -3499,7 +3499,7 @@ static void UpdateTownGrowthRate(Town *t) /** * Updates town growth state (whether it is growing or not). - * @param town The town to update growth for + * @param t The town to update growth for */ static void UpdateTownGrowth(Town *t) { diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 0607e0c725..34edfc6eb5 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -781,7 +781,7 @@ void GetTrainSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, * @param tile tile of the depot where rail-vehicle is built. * @param flags type of operation. * @param e the engine to build. - * @param ret[out] the vehicle that has been built. + * @param[out] ret the vehicle that has been built. * @return the cost of this operation or an error. */ static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const Engine *e, Vehicle **ret) @@ -918,7 +918,7 @@ static void AddRearEngineToMultiheadedTrain(Train *v) * @param flags type of operation. * @param e the engine to build. * @param data bit 0 prevents any free cars from being added to the train. - * @param ret[out] the vehicle that has been built. + * @param[out] ret the vehicle that has been built. * @return the cost of this operation or an error. */ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engine *e, uint16 data, Vehicle **ret) @@ -1082,7 +1082,7 @@ static void RemoveFromConsist(Train *part, bool chain = false) static void InsertInConsist(Train *dst, Train *chain) { /* We do not want to add something in the middle of an articulated part. */ - assert(dst->Next() == NULL || !dst->Next()->IsArticulatedPart()); + assert(dst != NULL && (dst->Next() == NULL || !dst->Next()->IsArticulatedPart())); chain->Last()->SetNext(dst->Next()); dst->SetNext(chain); @@ -1143,8 +1143,8 @@ static void NormaliseSubtypes(Train *chain) * @note All vehicles are/were 'heads' of their chains. * @param original_dst The original destination chain. * @param dst The destination chain after constructing the train. - * @param original_dst The original source chain. - * @param dst The source chain after constructing the train. + * @param original_src The original source chain. + * @param src The source chain after constructing the train. * @return possible error of this command. */ static CommandCost CheckNewTrain(Train *original_dst, Train *dst, Train *original_src, Train *src) @@ -1262,8 +1262,8 @@ static CommandCost CheckTrainAttachment(Train *t) * @note All vehicles are/were 'heads' of their chains. * @param original_dst The original destination chain. * @param dst The destination chain after constructing the train. - * @param original_dst The original source chain. - * @param dst The source chain after constructing the train. + * @param original_src The original source chain. + * @param src The source chain after constructing the train. * @param check_limit Whether to check the vehicle limit. * @return possible error of this command. */ @@ -1754,8 +1754,8 @@ static void MarkTrainAsStuck(Train *v, bool waiting_restriction = false) * Swap the two up/down flags in two ways: * - Swap values of \a swap_flag1 and \a swap_flag2, and * - If going up previously (#GVF_GOINGUP_BIT set), the #GVF_GOINGDOWN_BIT is set, and vice versa. - * @param swap_flag1 [inout] First train flag. - * @param swap_flag2 [inout] Second train flag. + * @param[in,out] swap_flag1 First train flag. + * @param[in,out] swap_flag2 Second train flag. */ static void SwapTrainFlags(uint16 *swap_flag1, uint16 *swap_flag2) { @@ -2367,9 +2367,9 @@ static FindDepotData FindClosestTrainDepot(Train *v, int max_distance) /** * Locate the closest depot for this consist, and return the information to the caller. - * @param location [out] If not \c NULL and a depot is found, store its location in the given address. - * @param destination [out] If not \c NULL and a depot is found, store its index in the given address. - * @param reverse [out] If not \c NULL and a depot is found, store reversal information in the given address. + * @param[out] location If not \c NULL and a depot is found, store its location in the given address. + * @param[out] destination If not \c NULL and a depot is found, store its index in the given address. + * @param[out] reverse If not \c NULL and a depot is found, store reversal information in the given address. * @return A depot has been found. */ bool Train::FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse) @@ -2750,9 +2750,9 @@ static const byte _initial_tile_subcoord[6][4][3] = { * @param tile The tile the train is about to enter * @param enterdir Diagonal direction the train is coming from * @param tracks Usable tracks on the new tile - * @param path_found [out] Whether a path has been found or not. + * @param[out] path_found Whether a path has been found or not. * @param do_track_reservation Path reservation is requested - * @param dest [out] State and destination of the requested path + * @param[out] dest State and destination of the requested path * @return The best track the train should follow */ static Track DoTrainPathfind(const Train *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool &path_found, bool do_track_reservation, PBSTileInfo *dest) @@ -2874,11 +2874,11 @@ static PBSTileInfo ExtendTrainReservation(const Train *v, const PBSTileInfo &ori * @param override_railtype Whether all physically compatible railtypes should be followed. * @return True if a path to a safe stopping tile could be reserved. */ -static bool TryReserveSafeTrack(const Train *v, TileIndex tile, Trackdir td, bool override_tailtype) +static bool TryReserveSafeTrack(const Train *v, TileIndex tile, Trackdir td, bool override_railtype) { switch (_settings_game.pf.pathfinder_for_trains) { - case VPF_NPF: return NPFTrainFindNearestSafeTile(v, tile, td, override_tailtype); - case VPF_YAPF: return YapfTrainFindNearestSafeTile(v, tile, td, override_tailtype); + case VPF_NPF: return NPFTrainFindNearestSafeTile(v, tile, td, override_railtype); + case VPF_YAPF: return YapfTrainFindNearestSafeTile(v, tile, td, override_railtype); default: NOT_REACHED(); } diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 9dd6af840d..e6abcbfa8d 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -213,40 +213,27 @@ static inline const PalSpriteID *GetBridgeSpriteTable(int index, BridgePieces ta /** - * Determines the foundation for the north bridge head, and tests if the resulting slope is valid. + * Determines the foundation for the bridge head, and tests if the resulting slope is valid. * + * @param bridge_piece Direction of the bridge head. * @param axis Axis of the bridge * @param tileh Slope of the tile under the north bridge head; returns slope on top of foundation * @param z TileZ corresponding to tileh, gets modified as well * @return Error or cost for bridge foundation */ -static CommandCost CheckBridgeSlopeNorth(Axis axis, Slope *tileh, int *z) +static CommandCost CheckBridgeSlope(BridgePieces bridge_piece, Axis axis, Slope *tileh, int *z) { + assert(bridge_piece == BRIDGE_PIECE_NORTH || bridge_piece == BRIDGE_PIECE_SOUTH); + Foundation f = GetBridgeFoundation(*tileh, axis); *z += ApplyFoundationToSlope(f, tileh); - Slope valid_inclined = (axis == AXIS_X ? SLOPE_NE : SLOPE_NW); - if ((*tileh != SLOPE_FLAT) && (*tileh != valid_inclined)) return CMD_ERROR; - - if (f == FOUNDATION_NONE) return CommandCost(); - - return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); -} - -/** - * Determines the foundation for the south bridge head, and tests if the resulting slope is valid. - * - * @param axis Axis of the bridge - * @param tileh Slope of the tile under the south bridge head; returns slope on top of foundation - * @param z TileZ corresponding to tileh, gets modified as well - * @return Error or cost for bridge foundation - */ -static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, int *z) -{ - Foundation f = GetBridgeFoundation(*tileh, axis); - *z += ApplyFoundationToSlope(f, tileh); - - Slope valid_inclined = (axis == AXIS_X ? SLOPE_SW : SLOPE_SE); + Slope valid_inclined; + if (bridge_piece == BRIDGE_PIECE_NORTH) { + valid_inclined = (axis == AXIS_X ? SLOPE_NE : SLOPE_NW); + } else { + valid_inclined = (axis == AXIS_X ? SLOPE_SW : SLOPE_SE); + } if ((*tileh != SLOPE_FLAT) && (*tileh != valid_inclined)) return CMD_ERROR; if (f == FOUNDATION_NONE) return CommandCost(); @@ -258,6 +245,7 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, int *z) * Is a bridge of the specified type and length available? * @param bridge_type Wanted type of bridge. * @param bridge_len Wanted length of the bridge. + * @param flags Type of operation. * @return A succeeded (the requested bridge is available) or failed (it cannot be built) command. */ CommandCost CheckBridgeAvailability(BridgeType bridge_type, uint bridge_len, DoCommandFlag flags) @@ -368,8 +356,8 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u Slope tileh_start = GetTileSlope(tile_start, &z_start); Slope tileh_end = GetTileSlope(tile_end, &z_end); - CommandCost terraform_cost_north = CheckBridgeSlopeNorth(direction, &tileh_start, &z_start); - CommandCost terraform_cost_south = CheckBridgeSlopeSouth(direction, &tileh_end, &z_end); + CommandCost terraform_cost_north = CheckBridgeSlope(BRIDGE_PIECE_NORTH, direction, &tileh_start, &z_start); + CommandCost terraform_cost_south = CheckBridgeSlope(BRIDGE_PIECE_SOUTH, direction, &tileh_end, &z_end); /* Aqueducts can't be built of flat land. */ if (transport_type == TRANSPORT_WATER && (tileh_start == SLOPE_FLAT || tileh_end == SLOPE_FLAT)) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); @@ -2513,11 +2501,11 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag /* Check if new slope is valid for bridges in general (so we can safely call GetBridgeFoundation()) */ if ((direction == DIAGDIR_NW) || (direction == DIAGDIR_NE)) { - CheckBridgeSlopeSouth(axis, &tileh_old, &z_old); - res = CheckBridgeSlopeSouth(axis, &tileh_new, &z_new); + CheckBridgeSlope(BRIDGE_PIECE_SOUTH, axis, &tileh_old, &z_old); + res = CheckBridgeSlope(BRIDGE_PIECE_SOUTH, axis, &tileh_new, &z_new); } else { - CheckBridgeSlopeNorth(axis, &tileh_old, &z_old); - res = CheckBridgeSlopeNorth(axis, &tileh_new, &z_new); + CheckBridgeSlope(BRIDGE_PIECE_NORTH, axis, &tileh_old, &z_old); + res = CheckBridgeSlope(BRIDGE_PIECE_NORTH, axis, &tileh_new, &z_new); } /* Surface slope is valid and remains unchanged? */ diff --git a/src/vehicle.cpp b/src/vehicle.cpp index e873ab808a..1cd5f7b3c7 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -106,7 +106,7 @@ static btree::btree_set _vehicles_to_sell; /** * Determine shared bounds of all sprites. - * @param [out] bounds Shared bounds. + * @param[out] bounds Shared bounds. */ Rect16 VehicleSpriteSeq::GetBounds() const { @@ -3779,7 +3779,7 @@ const uint16 &Vehicle::GetGroundVehicleFlags() const /** * Calculates the set of vehicles that will be affected by a given selection. - * @param set [inout] Set of affected vehicles. + * @param[in,out] set Set of affected vehicles. * @param v First vehicle of the selection. * @param num_vehicles Number of vehicles in the selection (not counting articulated parts). * @pre \a set must be empty. diff --git a/src/vehicle_base.h b/src/vehicle_base.h index bfc28db4a3..c515943c31 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -337,7 +337,7 @@ public: uint16 load_unload_ticks; ///< Ticks to wait before starting next cycle. GroupID group_id; ///< Index of group Pool array - byte subtype; ///< subtype (Filled with values from #EffectVehicles/#TrainSubTypes/#AircraftSubTypes) + byte subtype; ///< subtype (Filled with values from #AircraftSubType/#DisasterSubType/#EffectVehicleType/#GroundVehicleSubtypeFlags) DirectionByte cur_image_valid_dir; ///< NOSAVE: direction for which cur_image does not need to be regenerated on the next tick NewGRFCache grf_cache; ///< Cache of often used calculated NewGRF values @@ -452,7 +452,7 @@ public: /** * Gets the sprite to show for the given direction * @param direction the direction the vehicle is facing - * @param [out] result Vehicle sprite sequence. + * @param[out] result Vehicle sprite sequence. */ virtual void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const { result->Clear(); } diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index ff91966713..254e94bf99 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -251,7 +251,7 @@ CommandCost CmdSellVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 * @param engine_type Which engine to refit * @param new_cid Cargo type we are refitting to. * @param new_subtype New cargo subtype. - * @param [out] auto_refit_allowed The refit is allowed as an auto-refit. + * @param[out] auto_refit_allowed The refit is allowed as an auto-refit. * @return Price for refitting */ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed) @@ -283,7 +283,7 @@ static int GetRefitCostFactor(const Vehicle *v, EngineID engine_type, CargoID ne * @param engine_type Which engine to refit * @param new_cid Cargo type we are refitting to. * @param new_subtype New cargo subtype. - * @param [out] auto_refit_allowed The refit is allowed as an auto-refit. + * @param[out] auto_refit_allowed The refit is allowed as an auto-refit. * @return Price for refitting */ static CommandCost GetRefitCost(const Vehicle *v, EngineID engine_type, CargoID new_cid, byte new_subtype, bool *auto_refit_allowed) diff --git a/src/vehicle_func.h b/src/vehicle_func.h index 078b1d1ad7..a91e6c9f05 100644 --- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -31,7 +31,7 @@ static const Money VEHICLE_PROFIT_THRESHOLD = 10000; ///< Threshold for a /** * Helper to check whether an image index is valid for a particular vehicle. - * @param The type of vehicle. + * @tparam T The type of vehicle. * @param image_index The image index to check. * @return True iff the image index is valid. */ diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 3af8afaac0..4750200be6 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -932,7 +932,7 @@ struct RefitWindow : public Window { /** * Gets the #StringID to use for displaying capacity. - * @param Cargo and cargo subtype to check for capacity. + * @param option Cargo and cargo subtype to check for capacity. * @return INVALID_STRING_ID if there is no capacity. StringID to use in any other case. * @post String parameters have been set. */ diff --git a/src/viewport.cpp b/src/viewport.cpp index b58cbb1757..2cae0525c6 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -3775,7 +3775,6 @@ void UpdateTileSelection() break; default: NOT_REACHED(); - break; } _thd.new_pos.x = x1 & ~TILE_UNIT_MASK; _thd.new_pos.y = y1 & ~TILE_UNIT_MASK; diff --git a/src/viewport_sprite_sorter_sse4.cpp b/src/viewport_sprite_sorter_sse4.cpp index e685fff572..cd898f00e9 100644 --- a/src/viewport_sprite_sorter_sse4.cpp +++ b/src/viewport_sprite_sorter_sse4.cpp @@ -7,7 +7,7 @@ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . */ -/** @file viewport_sprite_sorter_sse.cpp Sprite sorter that uses SSE4.1. */ +/** @file viewport_sprite_sorter_sse4.cpp Sprite sorter that uses SSE4.1. */ #ifdef WITH_SSE diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index 592f2d0c86..9dfd6a16f1 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -911,7 +911,7 @@ static void GetTileDesc_Water(TileIndex tile, TileDesc *td) case WATER_CLASS_SEA: td->str = STR_LAI_WATER_DESCRIPTION_WATER; break; case WATER_CLASS_CANAL: td->str = STR_LAI_WATER_DESCRIPTION_CANAL; break; case WATER_CLASS_RIVER: td->str = STR_LAI_WATER_DESCRIPTION_RIVER; break; - default: NOT_REACHED(); break; + default: NOT_REACHED(); } break; case WATER_TILE_COAST: td->str = STR_LAI_WATER_DESCRIPTION_COAST_OR_RIVERBANK; break; @@ -920,7 +920,7 @@ static void GetTileDesc_Water(TileIndex tile, TileDesc *td) td->str = STR_LAI_WATER_DESCRIPTION_SHIP_DEPOT; td->build_date = Depot::GetByTile(tile)->build_date; break; - default: NOT_REACHED(); break; + default: NOT_REACHED(); } td->owner[0] = GetTileOwner(tile); diff --git a/src/widget.cpp b/src/widget.cpp index 4e411ada23..73190f5e67 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -755,7 +755,7 @@ NWidgetBase::NWidgetBase(WidgetType tp) : ZeroedMemoryAllocator() */ /** - * @fn void FillNestedArray(NWidgetBase **array, uint length) + * @fn void NWidgetBase::FillNestedArray(NWidgetBase **array, uint length) * Fill the Window::nested_array array with pointers to nested widgets in the tree. * @param array Base pointer of the array. * @param length Length of the array. @@ -1673,10 +1673,10 @@ NWidgetCore *NWidgetMatrix::GetWidgetFromPos(int x, int y) /** * Get the different offsets that are influenced by scrolling. - * @param [out] start_x The start position in columns (index of the left-most column, swapped in RTL). - * @param [out] start_y The start position in rows. - * @param [out] base_offs_x The base horizontal offset in pixels (X position of the column \a start_x). - * @param [out] base_offs_y The base vertical offset in pixels (Y position of the column \a start_y). + * @param[out] start_x The start position in columns (index of the left-most column, swapped in RTL). + * @param[out] start_y The start position in rows. + * @param[out] base_offs_x The base horizontal offset in pixels (X position of the column \a start_x). + * @param[out] base_offs_y The base vertical offset in pixels (Y position of the column \a start_y). */ void NWidgetMatrix::GetScrollOffsets(int &start_x, int &start_y, int &base_offs_x, int &base_offs_y) { @@ -2805,7 +2805,7 @@ NWidgetContainer *MakeNWidgets(const NWidgetPart *parts, int count, int *biggest * @param parts Array with parts of the widgets. * @param count Length of the \a parts array. * @param biggest_index Pointer to biggest nested widget index collected in the tree. - * @param [out] shade_select Pointer to the inserted shade selection widget (\c NULL if not unserted). + * @param[out] shade_select Pointer to the inserted shade selection widget (\c NULL if not unserted). * @return Root of the nested widget tree, a vertical container containing the entire GUI. * @ingroup NestedWidgetParts * @pre \c biggest_index != NULL diff --git a/src/widget_type.h b/src/widget_type.h index 163d45800e..33fb8bce08 100644 --- a/src/widget_type.h +++ b/src/widget_type.h @@ -257,7 +257,7 @@ enum NWidgetDisplay { NDB_SHADE_GREY = 3, ///< Shade viewport to grey-scale. NDB_SHADE_DIMMED = 4, ///< Display dimmed colours in the viewport. /* Button dropdown widget. */ - NDB_DROPDOWN_ACTIVE = 5, ///< Dropdown menu of the button dropdown widget is active. @see #NWID_BUTTON_DRPDOWN + NDB_DROPDOWN_ACTIVE = 5, ///< Dropdown menu of the button dropdown widget is active. @see #NWID_BUTTON_DROPDOWN /* Scrollbar widget. */ NDB_SCROLLBAR_UP = 6, ///< Up-button is lowered bit. NDB_SCROLLBAR_DOWN = 7, ///< Down-button is lowered bit. @@ -400,7 +400,7 @@ enum StackedZeroSizePlanes { * There are also a number of special planes (defined in #StackedZeroSizePlanes) that have zero size in one direction (and are stretchable in * the other direction) or have zero size in both directions. They are used to make all child planes of the widget disappear. * Unlike switching between the regular display planes (that all have the same size), switching from or to one of the zero-sized planes means that - * a #Windows::ReInit() is needed to re-initialize the window since its size changes. + * a #Window::ReInit() is needed to re-initialize the window since its size changes. */ class NWidgetStacked : public NWidgetContainer { public: @@ -567,7 +567,7 @@ private: * Nested widget to display a viewport in a window. * After initializing the nested widget tree, call #InitializeViewport(). After changing the window size, * call #UpdateViewportCoordinates() eg from Window::OnResize(). - * If the #display_flags field contains the #ND_NO_TRANSPARENCY bit, the viewport will disable transparency. + * If the #disp_flags field contains the #ND_NO_TRANSPARENCY bit, the viewport will disable transparency. * Shading to grey-scale is controlled with the #ND_SHADE_GREY bit (used for B&W news papers), the #ND_SHADE_DIMMED gives dimmed colours (for colour news papers). * @todo Class derives from #NWidgetCore, but does not use #colour, #widget_data, or #tool_tip. * @ingroup NestedWidgets @@ -1124,8 +1124,8 @@ static inline NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx = -1) /** * Widget part function for starting a new horizontal container, vertical container, or spacer widget. - * @param tp Type of the new nested widget, #NWID_HORIZONTAL(_LTR), #NWID_VERTICAL, #NWID_SPACER, #NWID_SELECTION, and #NWID_MATRIX. - * @param cont_flags Flags for the containers (#NWID_HORIZONTAL(_LTR) and #NWID_VERTICAL). + * @param tp Type of the new nested widget, #NWID_HORIZONTAL, #NWID_VERTICAL, #NWID_SPACER, #NWID_SELECTION, and #NWID_MATRIX. + * @param cont_flags Flags for the containers (#NWID_HORIZONTAL and #NWID_VERTICAL). * @ingroup NestedWidgetParts */ static inline NWidgetPart NWidget(WidgetType tp, NWidContainerFlags cont_flags = NC_NONE) diff --git a/src/widgets/cheat_widget.h b/src/widgets/cheat_widget.h index 78758f7b11..3209cae239 100644 --- a/src/widgets/cheat_widget.h +++ b/src/widgets/cheat_widget.h @@ -12,7 +12,7 @@ #ifndef WIDGETS_CHEAT_WIDGET_H #define WIDGETS_CHEAT_WIDGET_H -/** Widgets of the #CheatWindow class.. */ +/** Widgets of the #CheatWindow class. */ enum CheatWidgets { WID_C_PANEL, ///< Panel where all cheats are shown in. }; diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index b5c6f0bf60..014cbdf180 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -112,7 +112,6 @@ struct DropdownWindow : Window { * @param size Size of the dropdown menu window. * @param wi_colour Colour of the parent widget. * @param scroll Dropdown menu has a scrollbar. - * @param widget Widgets of the dropdown menu window. */ DropdownWindow(Window *parent, const DropDownList *list, int selected, int button, bool instant_close, const Point &position, const Dimension &size, Colours wi_colour, bool scroll, DropDownSyncFocus sync_parent_focus) : Window(&_dropdown_desc) @@ -187,7 +186,7 @@ struct DropdownWindow : Window { /** * Find the dropdown item under the cursor. - * @param value [out] Selected item, if function returns \c true. + * @param[out] value Selected item, if function returns \c true. * @return Cursor points to a dropdown item. */ bool GetDropDownItem(int &value) diff --git a/src/window.cpp b/src/window.cpp index 79c435ed06..bd0509aa8e 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -49,7 +49,7 @@ enum ViewportAutoscrolling { }; static Point _drag_delta; ///< delta between mouse cursor and upper left corner of dragged window -static Window *_mouseover_last_w = NULL; ///< Window of the last #MOUSEOVER event. +static Window *_mouseover_last_w = NULL; ///< Window of the last OnMouseOver event. static Window *_last_scroll_window = NULL; ///< Window of the last scroll event. /** List of windows opened at the screen sorted from the front. */ @@ -941,6 +941,8 @@ static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bo void DrawOverlappedWindowForAll(int left, int top, int right, int bottom) { Window *w; + + DrawPixelInfo *old_dpi = _cur_dpi; DrawPixelInfo bk; _cur_dpi = &bk; @@ -954,6 +956,7 @@ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom) DrawOverlappedWindow(w, max(left, w->left), max(top, w->top), min(right, w->left + w->width), min(bottom, w->top + w->height)); } } + _cur_dpi = old_dpi; } /** @@ -1118,7 +1121,7 @@ Window *FindWindowById(WindowClass cls, WindowNumber number) /** * Find any window by its class. Useful when searching for a window that uses - * the window number as a #WindowType, like #WC_SEND_NETWORK_MSG. + * the window number as a #WindowClass, like #WC_SEND_NETWORK_MSG. * @param cls Window class * @return Pointer to the found window, or \c NULL if not available */ @@ -1435,7 +1438,6 @@ static void BringWindowToFront(Window *w) /** * Initializes the data (except the position and initial size) of a new Window. - * @param desc Window description. * @param window_number Number being assigned to the new window * @return Window pointer of the newly created window * @pre If nested widgets are used (\a widget is \c NULL), #nested_root and #nested_array_size must be initialized. @@ -2007,7 +2009,7 @@ static void HandleMouseOver() { Window *w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y); - /* We changed window, put a MOUSEOVER event to the last window */ + /* We changed window, put an OnMouseOver event to the last window */ if (_mouseover_last_w != NULL && _mouseover_last_w != w) { /* Reset mouse-over coordinates of previous window */ Point pt = { -1, -1 }; @@ -2775,18 +2777,17 @@ static void HandleAutoscroll() y -= vp->top; /* here allows scrolling in both x and y axis */ -#define scrollspeed 3 + static const int SCROLLSPEED = 3; if (x - 15 < 0) { - w->viewport->dest_scrollpos_x += ScaleByZoom((x - 15) * scrollspeed, vp->zoom); + w->viewport->dest_scrollpos_x += ScaleByZoom((x - 15) * SCROLLSPEED, vp->zoom); } else if (15 - (vp->width - x) > 0) { - w->viewport->dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * scrollspeed, vp->zoom); + w->viewport->dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * SCROLLSPEED, vp->zoom); } if (y - 15 < 0) { - w->viewport->dest_scrollpos_y += ScaleByZoom((y - 15) * scrollspeed, vp->zoom); + w->viewport->dest_scrollpos_y += ScaleByZoom((y - 15) * SCROLLSPEED, vp->zoom); } else if (15 - (vp->height - y) > 0) { - w->viewport->dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * scrollspeed, vp->zoom); + w->viewport->dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * SCROLLSPEED, vp->zoom); } -#undef scrollspeed } enum MouseClick {