Loading
#openttdcoop - Paste
Archives
Trending
Docs
Login
ABAP
ActionScript
ActionScript 3
Ada
AIMMS3
ALGOL 68
Apache configuration
AppleScript
Apt sources
ARM ASSEMBLER
ASM
ASP
asymptote
Autoconf
Autohotkey
AutoIt
AviSynth
awk
BASCOM AVR
Bash
Basic4GL
BibTeX
BlitzBasic
bnf
Boo
Brainfuck
C
C#
C (LoadRunner)
C (Mac)
C (WinAPI)
C++
C++ (Qt)
C++ (WinAPI)
CAD DCL
CAD Lisp
CFDG
ChaiScript
Chapel
CIL
Clojure
CMake
COBOL
CoffeeScript
ColdFusion
CSS
Cuesheet
D
Dart
DCL
DCPU-16 Assembly
DCS
Delphi
Diff
DIV
DOS
dot
E
ECMAScript
Eiffel
eMail (mbox)
EPC
Erlang
Euphoria
EZT
F#
Falcon
FO (abas-ERP)
Formula One
Fortran
FreeBasic
FreeSWITCH
GADV 4CS
GAMBAS
GDB
genero
Genie
glSlang
GML
GNU/Octave
GNU Gettext
GNU make
Gnuplot
Go
Groovy
GwBasic
Haskell
Haxe
HicEst
HQ9+
HTML
HTML5
Icon
INI
Inno
INTERCAL
Io
ISPF Panel
J
Java
Java(TM) 2 Platform Standard Edition 5.0
Javascript
JCL
jQuery
KiXtart
KLone C
KLone C++
LaTeX
LDIF
Liberty BASIC
Lisp
LLVM Intermediate Representation
Locomotive Basic
Logtalk
LOLcode
Lotus Notes @Formulas
LotusScript
LScript
LSL2
Lua
MagikSF
MapBasic
Matlab M
Microchip Assembler
Microsoft Registry
mIRC Scripting
MMIX
Modula-2
Modula-3
MOS 6502 (6510) ACME Cross Assembler format
MOS 6502 (6510) Kick Assembler format
MOS 6502 (6510) TASM/64TASS 1.46 Assembler format
Motorola 68000 - HiSoft Devpac ST 2 Assembler format
Motorola 68000 Assembler
MXML
MySQL
Nagios
NetRexx
newlisp
nginx
Nimrod
NML NewGRF Meta Language
NSIS
Oberon-2
Objeck Programming Language
Objective-C
OCaml
OCaml (brief)
ooRexx
OpenBSD Packet Filter
OpenOffice.org Basic
Oracle 8 SQL
Oracle 11 SQL
Oxygene
OZ
ParaSail
PARI/GP
Pascal
PCRE
per
Perl
Perl 6
PHP
PHP (brief)
PIC16
Pike
Pixel Bender 1.0
PL/I
PL/SQL
PostgreSQL
PostScript
POVRAY
PowerBuilder
PowerShell
ProFTPd configuration
Progress
Prolog
PROPERTIES
ProvideX
Puppet
PureBasic
Python
Python for S60
q/kdb+
QBasic/QuickBASIC
QML
R / S+
Racket
Rails
RBScript
REBOL
rexx
robots.txt
RPM Specification File
Ruby
Rust
SAS
Scala
Scheme
SciLab
SCL
sdlBasic
Smalltalk
Smarty
SPARK
SPARQL
SQL
Squirrel Script
Squirrel Script with OpenTTD AI/GS
StandardML
StoneScript
SystemVerilog
T-SQL
TCL
Tera Term Macro
Text
thinBasic
TypoScript
Unicon (Unified Extended Dialect of Icon)
Uno Idl
Unreal Script
UPC
Urbi
Vala
vb.net
VBScript
Vedit macro language
Verilog
VHDL
Vim Script
Visual Basic
Visual Fox Pro
Visual Prolog
Whitespace
Whois (RPSL format)
Winbatch
X++
XBasic
XML
Xorg configuration
YAML
ZiLOG Z80 Assembler
ZXBasic
diff -r 614b4710dc7e webtranslate/newgrf/language_file.py --- a/webtranslate/newgrf/language_file.py Wed May 27 19:44:13 2015 +0200 +++ b/webtranslate/newgrf/language_file.py Thu May 28 17:59:54 2015 +0200 @@ -34,7 +34,7 @@ gender_assign_pat = re.compile('{G *= *([^ }]+) *}') argument_pat = re.compile('[ \\t]+([^"][^ \\t}]*|"[^"}]*")') end_argument_pat = re.compile('[ \\t]*}') -number_pat = re.compile('[0-9]+$') +posref_pat = re.compile('([0-9]+)(:([0-9]+))?$') def check_string(projtype, text, default_case, extra_commands, lng, in_blng, save_pieces = False): """ @@ -130,7 +130,7 @@ string_info.add_error(ErrorMessage(ERROR, None, "Case {} of string command {} does not exist in the language".format(case, m.group(2)))) return string_info - if not entry.takes_param: + if len(entry.parameters) == 0: if argnum is not None: string_info.add_error(ErrorMessage(ERROR, None, "String command {} does not take an argument count".format(m.group(2)))) return string_info @@ -154,14 +154,22 @@ return string_info elif len(args) > 0: # If the first argument is a number, it cannot be a value for the plural command. - m = number_pat.match(args[0]) + m = posref_pat.match(args[0]) if m: - num = int(args[0], 10) - cmd_num = num + num = int(m.group(1), 10) + sub = m.group(3) + + if sub is None: + cmd_num = (num, None) + num = (num, 0) + else: + sub = int(sub, 10) + num = cmd_num = (num, sub) + cmd_args = args[1:] else: - num = pos - 1 - cmd_num = None + num = (pos - 1, 0) + cmd_num = (None, None) cmd_args = args if len(cmd_args) == plural_count: @@ -206,14 +214,22 @@ return string_info elif len(args) > 0: # If the first argument is a number, it cannot be a value for the plural command. - m = number_pat.match(args[0]) + m = posref_pat.match(args[0]) if m: - num = int(args[0], 10) - cmd_num = num + num = int(m.group(1), 10) + sub = m.group(3) + + if sub is None: + cmd_num = (num, None) + num = (num, 0) + else: + sub = int(sub, 10) + num = cmd_num = (num, sub) + cmd_args = args[1:] else: - num = pos - cmd_num = None + num = (pos, 0) + cmd_num = (None, None) cmd_args = args if len(cmd_args) == expected: @@ -227,7 +243,9 @@ string_info.add_error(ErrorMessage(ERROR, None, "Unknown {...} command found in the string")) return string_info - string_info.check_sanity() + if in_blng: + string_info.check_plural_and_gender(string_info) + return string_info # {{{ def get_arguments(text, cmd, idx, string_info): @@ -351,7 +369,7 @@ Piece representing a plural {P ...} command. @param cmd_num: Number given to the command by the user, if provided. - @type cmd_num: C{int} or C{None} + @type cmd_num: C{pair} of (C{int} or C{None}) @ivar cmd_args: Plural command arguments. @type cmd_args: C{list} of C{str} @@ -361,10 +379,12 @@ self.cmd_num = cmd_num def get_translation_text(self): - if self.cmd_num is None: - prefix = "{P " - else: - prefix = "{P " + str(self.cmd_num) + " " + prefix = "{P " + if self.cmd_num[0] is not None: + prefix += str(self.cmd_num[0]) + if self.cmd_num[1] is not None: + prefix += ":" + str(self.cmd_num[1]) + prefix += " " return prefix + " ".join(self.cmd_args) + "}" class GenderPiece(StringPiece): @@ -372,7 +392,7 @@ Piece representing a gender {G ...} command. @param cmd_num: Number given to the command by the user, if provided. - @type cmd_num: C{int} or C{None} + @type cmd_num: C{pair} of (C{int} or C{None}) @ivar cmd_args: Gender command arguments. @type cmd_args: C{list} of C{str} @@ -382,10 +402,12 @@ self.cmd_num = cmd_num def get_translation_text(self): - if self.cmd_num is None: - prefix = "{G " - else: - prefix = "{G " + str(self.cmd_num) + " " + prefix = "{G " + if self.cmd_num[0] is not None: + prefix += str(self.cmd_num[0]) + if self.cmd_num[1] is not None: + prefix += ":" + str(self.cmd_num[1]) + prefix += " " return prefix + " ".join(self.cmd_args) + "}" class GenderAssignPiece(StringPiece): @@ -500,10 +522,10 @@ Add a gender query for parameter L{pos}. @param pos: String parameter number used for gender query. - @type pos: C{int} + @type pos: (C{int}, C{int}) @param cmd_num: Number given to the command by the user, if provided. - @type cmd_num: C{int} or C{None} + @type cmd_num: C{pair} of (C{int} or C{None}) @param cmd_args: Command arguments. @type cmd_args: C{list} of C{str} @@ -517,10 +539,10 @@ Add a plural query for parameter L{pos}. @param pos: String parameter number used for plural query. - @type pos: C{int} + @type pos: (C{int}, C{int}) @param cmd_num: Number given to the command by the user, if provided. - @type cmd_num: C{int} or C{None} + @type cmd_num: C{pair} of (C{int} or C{None}) @param cmd_args: Command arguments. @type cmd_args: C{list} of C{str} @@ -607,32 +629,60 @@ """ self.pieces.append(GenderAssignPiece(gender)) - def check_sanity(self): + def check_plural_and_gender(self, base_info): """ - Check sanity of the string commands and parameters. + Check plural and gender parameter references. + + Note: The base language is required to know the exact string commands and amount of sub-parameters. + + @param base_info: Information about string parameters from the base language. + @type base_info: L{StringInfo} + + @return: True of references are valid. + @rtype: C{bool} """ ok = True if ok: - for pos in self.plurals: - if pos < 0 or pos >= len(self.commands): - self.add_error(ErrorMessage(ERROR, None, "String parameter {} is out of bounds for plural queries {{P ..}}".format(pos))) + for pos, sub in self.plurals: + pos_name = str(pos) + if sub > 0: + pos_name += ":" + str(sub) + + if pos < 0 or pos >= len(base_info.commands): + self.add_error(ErrorMessage(ERROR, None, "String parameter {} is out of bounds for plural queries {{P ..}}".format(pos_name))) ok = False continue - cmd = self.commands[pos] - if cmd is None or not cmd.use_plural: - self.add_error(ErrorMessage(ERROR, None, "String parameter {} may not be used for plural queries {{P ..}}".format(pos))) + cmd = base_info.commands[pos] + if cmd is None or sub < 0 or sub >= len(cmd.parameters): + self.add_error(ErrorMessage(ERROR, None, "Plural query {{P ..}} references non-existing parameter {}.".format(pos_name))) + ok = False + continue + + if not cmd.use_plural(sub): + self.add_error(ErrorMessage(ERROR, None, "String parameter {} may not be used for plural queries {{P ..}}".format(pos_name))) ok = False if ok: - for pos in self.genders: - if pos < 0 or pos >= len(self.commands): - self.add_error(ErrorMessage(ERROR, None, "String parameter {} is out of bounds for gender queries {{G ..}}".format(pos))) + for pos, sub in self.genders: + pos_name = str(pos) + if sub > 0: + pos_name += ":" + str(sub) + + if pos < 0 or pos >= len(base_info.commands): + self.add_error(ErrorMessage(ERROR, None, "String parameter {} is out of bounds for gender queries {{G ..}}".format(pos_name))) continue - cmd = self.commands[pos] - if cmd is None or not cmd.use_gender: - self.add_error(ErrorMessage(ERROR, None, "String parameter {} may not be used for gender queries {{G ..}}".format(pos))) + cmd = base_info.commands[pos] + if cmd is None or sub < 0 or sub >= len(cmd.parameters): + self.add_error(ErrorMessage(ERROR, None, "Gender query {{G ..}} references non-existing parameter {}.".format(pos_name))) + ok = False + continue + + if not cmd.use_gender(sub): + self.add_error(ErrorMessage(ERROR, None, "String parameter {} may not be used for gender queries {{G ..}}".format(pos_name))) + + return ok # }}} # }}} @@ -869,7 +919,9 @@ if line.startswith(bom): line = line[len(bom):] - if line.startswith('##'): + # Comments either have 1 or >= 3 leading '#'. + # The pragma ##id is special. It belongs to the skeleton, not to the header. Threat it like a comment. + if line.startswith('##') and not line.startswith('###') and not line.startswith('##id'): if seen_strings: data.add_error(ErrorMessage(ERROR, lnum, "Cannot change language properties after processing strings")) continue @@ -991,6 +1043,10 @@ lng_info.add_error(ErrorMessage(ERROR, None, msg)) return False + # Validate plural and gender references + if not lng_info.check_plural_and_gender(base_info): + return False + # Non-positional commands must match in count. if base_info.non_positionals != lng_info.non_positionals: for bname, bcnt in base_info.non_positionals.items(): diff -r 614b4710dc7e webtranslate/project_type.py --- a/webtranslate/project_type.py Wed May 27 19:44:13 2015 +0200 +++ b/webtranslate/project_type.py Thu May 28 17:59:54 2015 +0200 @@ -107,14 +107,8 @@ @ivar literal: Text of the literal (without curly brackets). @type literal: C{str} - @ivar takes_param: Takes a string parameter. - @type takes_param: C{bool} - - @ivar use_plural: May be used for plural. - @type use_plural: C{bool} - - @ivar use_gender: May be used for gender. - @type use_gender: C{bool} + @ivar parameters: For each parameter whether it is suitable for plural or gender forms. + @type parameters: C{list} of (C{bool}, C{bool}) @ivar allow_case: May have a ".case" suffix. @type allow_case: C{bool} @@ -125,15 +119,37 @@ @ivar translated_cmd: For commands in the base language, command to use checking and displaying. @type translated_cmd: C{str} or C{None} (the latter means use C{self}) """ - def __init__(self, literal, takes_param, use_plural, use_gender, allow_case, critical, translated_cmd = None): + def __init__(self, literal, parameters, allow_case, critical, translated_cmd = None): self.literal = literal - self.takes_param = takes_param - self.use_plural = use_plural - self.use_gender = use_gender + self.parameters = parameters self.allow_case = allow_case self.critical = critical self.translated_cmd = translated_cmd + def use_plural(self, subindex): + """ + Check whether a parameter can be used for plural forms. + + @param subindex: Parameter index. + @type subindex: C{int} + + @return: True if suitable for plural form. + @rtype: C{bool} + """ + return subindex >= 0 and subindex < len(self.parameters) and self.parameters[subindex][0] + + def use_gender(self, subindex): + """ + Check whether a parameter can be used for gender forms. + + @param subindex: Parameter index. + @type subindex: C{int} + + @return: True if suitable for gender form. + @rtype: C{bool} + """ + return subindex >= 0 and subindex < len(self.parameters) and self.parameters[subindex][1] + def get_translated_cmd(self): """ Get the command name to use for a translation. @@ -144,56 +160,61 @@ if self.translated_cmd is None: return self.literal return self.translated_cmd +P__ = (False, False) # Parameter, not suitable for plural or gender +PP_ = (True, False) # Parameter suitable for plural +P_G = (False, True) # Parameter suitable for gender +PPG = (True, True) # Parameter suitable for both plural and gender + # {{{ NEWGRF_PARAMETERS _NEWGRF_PARAMETERS = [ - ParameterInfo("NBSP", False, False, False, False, False), - ParameterInfo("COPYRIGHT", False, False, False, False, True ), - ParameterInfo("TRAIN", False, False, False, False, True ), - ParameterInfo("LORRY", False, False, False, False, True ), - ParameterInfo("BUS", False, False, False, False, True ), - ParameterInfo("PLANE", False, False, False, False, True ), - ParameterInfo("SHIP", False, False, False, False, True ), - ParameterInfo("TINYFONT", False, False, False, False, True ), - ParameterInfo("BIGFONT", False, False, False, False, True ), - ParameterInfo("BLUE", False, False, False, False, True ), - ParameterInfo("SILVER", False, False, False, False, True ), - ParameterInfo("GOLD", False, False, False, False, True ), - ParameterInfo("RED", False, False, False, False, True ), - ParameterInfo("PURPLE", False, False, False, False, True ), - ParameterInfo("LTBROWN", False, False, False, False, True ), - ParameterInfo("ORANGE", False, False, False, False, True ), - ParameterInfo("GREEN", False, False, False, False, True ), - ParameterInfo("YELLOW", False, False, False, False, True ), - ParameterInfo("DKGREEN", False, False, False, False, True ), - ParameterInfo("CREAM", False, False, False, False, True ), - ParameterInfo("BROWN", False, False, False, False, True ), - ParameterInfo("WHITE", False, False, False, False, True ), - ParameterInfo("LTBLUE", False, False, False, False, True ), - ParameterInfo("GRAY", False, False, False, False, True ), - ParameterInfo("DKBLUE", False, False, False, False, True ), - ParameterInfo("BLACK", False, False, False, False, True ), + ParameterInfo("NBSP", [], False, False), + ParameterInfo("COPYRIGHT", [], False, True ), + ParameterInfo("TRAIN", [], False, True ), + ParameterInfo("LORRY", [], False, True ), + ParameterInfo("BUS", [], False, True ), + ParameterInfo("PLANE", [], False, True ), + ParameterInfo("SHIP", [], False, True ), + ParameterInfo("TINYFONT", [], False, True ), + ParameterInfo("BIGFONT", [], False, True ), + ParameterInfo("BLUE", [], False, True ), + ParameterInfo("SILVER", [], False, True ), + ParameterInfo("GOLD", [], False, True ), + ParameterInfo("RED", [], False, True ), + ParameterInfo("PURPLE", [], False, True ), + ParameterInfo("LTBROWN", [], False, True ), + ParameterInfo("ORANGE", [], False, True ), + ParameterInfo("GREEN", [], False, True ), + ParameterInfo("YELLOW", [], False, True ), + ParameterInfo("DKGREEN", [], False, True ), + ParameterInfo("CREAM", [], False, True ), + ParameterInfo("BROWN", [], False, True ), + ParameterInfo("WHITE", [], False, True ), + ParameterInfo("LTBLUE", [], False, True ), + ParameterInfo("GRAY", [], False, True ), + ParameterInfo("DKBLUE", [], False, True ), + ParameterInfo("BLACK", [], False, True ), - ParameterInfo("COMMA", True, True, False, False, True ), - ParameterInfo("SIGNED_WORD", True, True, False, False, True ), - ParameterInfo("UNSIGNED_WORD", True, True, False, False, True ), - ParameterInfo("CURRENCY", True, False, False, False, True ), - ParameterInfo("VELOCITY", True, False, False, False, True ), - ParameterInfo("VOLUME", True, False, False, False, True ), - ParameterInfo("VOLUME_SHORT", True, False, False, False, True ), - ParameterInfo("POWER", True, False, False, False, True ), - ParameterInfo("WEIGHT", True, False, False, False, True ), - ParameterInfo("WEIGHT_SHORT", True, False, False, False, True ), - ParameterInfo("CARGO_LONG", True, False, True, False, True ), - ParameterInfo("CARGO_SHORT", True, False, False, False, True ), # short cargo description, only ### tons, or ### litres - ParameterInfo("CARGO_TINY", True, False, False, False, True ), # tiny cargo description with only the amount - ParameterInfo("HEX", True, True, False, False, True ), - ParameterInfo("STRING", True, False, True , True, True ), - ParameterInfo("DATE1920_LONG", True, False, False, False, True ), - ParameterInfo("DATE1920_SHORT", True, False, False, False, True ), - ParameterInfo("DATE_LONG", True, False, False, False, True ), - ParameterInfo("DATE_SHORT", True, False, False, False, True ), - ParameterInfo("POP_WORD", True, False, False, False, True ), - ParameterInfo("STATION", True, False, False, False, True ), + ParameterInfo("COMMA", [PP_], False, True ), + ParameterInfo("SIGNED_WORD", [PP_], False, True ), + ParameterInfo("UNSIGNED_WORD", [PP_], False, True ), + ParameterInfo("CURRENCY", [PP_], False, True ), + ParameterInfo("VELOCITY", [PP_], False, True ), + ParameterInfo("VOLUME", [PP_], False, True ), + ParameterInfo("VOLUME_SHORT", [PP_], False, True ), + ParameterInfo("POWER", [PP_], False, True ), + ParameterInfo("WEIGHT", [PP_], False, True ), + ParameterInfo("WEIGHT_SHORT", [PP_], False, True ), + ParameterInfo("CARGO_LONG", [P_G, PP_], False, True ), + ParameterInfo("CARGO_SHORT", [P__, PP_], False, True ), # short cargo description, only ### tons, or ### litres + ParameterInfo("CARGO_TINY", [P__, PP_], False, True ), # tiny cargo description with only the amount + ParameterInfo("HEX", [PP_], False, True ), + ParameterInfo("STRING", [P_G], True, True ), + ParameterInfo("DATE1920_LONG", [P__], False, True ), + ParameterInfo("DATE1920_SHORT", [P__], False, True ), + ParameterInfo("DATE_LONG", [P__], False, True ), + ParameterInfo("DATE_SHORT", [P__], False, True ), + ParameterInfo("POP_WORD", [P__], False, True ), + ParameterInfo("STATION", [P__], False, True ), ] NEWGRF_PARAMETERS = dict((x.literal, x) for x in _NEWGRF_PARAMETERS) @@ -201,95 +222,95 @@ # {{{ GS_PARAMETERS # Based on OpenTTD src/tables/strgen_tables.h r26050 _GS_PARAMETERS = [ - ParameterInfo("TINY_FONT", False, False, False, False, True ), - ParameterInfo("BIG_FONT", False, False, False, False, True ), + ParameterInfo("TINY_FONT", [], False, True ), + ParameterInfo("BIG_FONT", [], False, True ), - ParameterInfo("BLUE", False, False, False, False, False), - ParameterInfo("SILVER", False, False, False, False, False), - ParameterInfo("GOLD", False, False, False, False, False), - ParameterInfo("RED", False, False, False, False, False), - ParameterInfo("PURPLE", False, False, False, False, False), - ParameterInfo("LTBROWN", False, False, False, False, False), - ParameterInfo("ORANGE", False, False, False, False, False), - ParameterInfo("GREEN", False, False, False, False, False), - ParameterInfo("YELLOW", False, False, False, False, False), - ParameterInfo("DKGREEN", False, False, False, False, False), - ParameterInfo("CREAM", False, False, False, False, False), - ParameterInfo("BROWN", False, False, False, False, False), - ParameterInfo("WHITE", False, False, False, False, False), - ParameterInfo("LTBLUE", False, False, False, False, False), - ParameterInfo("GRAY", False, False, False, False, False), - ParameterInfo("DKBLUE", False, False, False, False, False), - ParameterInfo("BLACK", False, False, False, False, False), + ParameterInfo("BLUE", [], False, False), + ParameterInfo("SILVER", [], False, False), + ParameterInfo("GOLD", [], False, False), + ParameterInfo("RED", [], False, False), + ParameterInfo("PURPLE", [], False, False), + ParameterInfo("LTBROWN", [], False, False), + ParameterInfo("ORANGE", [], False, False), + ParameterInfo("GREEN", [], False, False), + ParameterInfo("YELLOW", [], False, False), + ParameterInfo("DKGREEN", [], False, False), + ParameterInfo("CREAM", [], False, False), + ParameterInfo("BROWN", [], False, False), + ParameterInfo("WHITE", [], False, False), + ParameterInfo("LTBLUE", [], False, False), + ParameterInfo("GRAY", [], False, False), + ParameterInfo("DKBLUE", [], False, False), + ParameterInfo("BLACK", [], False, False), - ParameterInfo("STRING1", True, True, True, True, True, "STRING"), - ParameterInfo("STRING2", True, True, True, True, True, "STRING"), - ParameterInfo("STRING3", True, True, True, True, True, "STRING"), - ParameterInfo("STRING4", True, True, True, True, True, "STRING"), - ParameterInfo("STRING5", True, True, True, True, True, "STRING"), - ParameterInfo("STRING6", True, True, True, True, True, "STRING"), - ParameterInfo("STRING7", True, True, True, True, True, "STRING"), + ParameterInfo("STRING1", [P_G, PPG], True, True, "STRING"), + ParameterInfo("STRING2", [P_G, PPG, PPG], True, True, "STRING"), + ParameterInfo("STRING3", [P_G, PPG, PPG, PPG], True, True, "STRING"), + ParameterInfo("STRING4", [P_G, PPG, PPG, PPG, PPG], True, True, "STRING"), + ParameterInfo("STRING5", [P_G, PPG, PPG, PPG, PPG, PPG], True, True, "STRING"), + ParameterInfo("STRING6", [P_G, PPG, PPG, PPG, PPG, PPG, PPG], True, True, "STRING"), + ParameterInfo("STRING7", [P_G, PPG, PPG, PPG, PPG, PPG, PPG, PPG], True, True, "STRING"), - ParameterInfo("INDUSTRY", True, False, True, True, True ), # takes an industry number. - ParameterInfo("CARGO_LONG", True, False, True, False, True ), - ParameterInfo("CARGO_SHORT", True, False, False, False, True ), # short cargo description, only ### tons, or ### litres - ParameterInfo("CARGO_TINY", True, False, False, False, True ), # tiny cargo description with only the amount - ParameterInfo("CARGO_LIST", True, False, False, True, True ), - ParameterInfo("POWER", True, False, False, False, True ), - ParameterInfo("VOLUME_LONG", True, False, False, False, True ), - ParameterInfo("VOLUME_SHORT", True, False, False, False, True ), - ParameterInfo("WEIGHT_LONG", True, False, False, False, True ), - ParameterInfo("WEIGHT_SHORT", True, False, False, False, True ), - ParameterInfo("FORCE", True, False, False, False, True ), - ParameterInfo("VELOCITY", True, False, False, False, True ), - ParameterInfo("HEIGHT", True, False, False, False, True ), - ParameterInfo("DATE_TINY", True, False, False, False, True ), - ParameterInfo("DATE_SHORT", True, False, False, True, True ), - ParameterInfo("DATE_LONG", True, False, False, True, True ), - ParameterInfo("DATE_ISO", True, False, False, False, True ), + ParameterInfo("INDUSTRY", [P_G], True, True ), # takes an industry number. + ParameterInfo("CARGO_LONG", [P_G, PP_], False, True ), + ParameterInfo("CARGO_SHORT", [P__, PP_], False, True ), # short cargo description, only ### tons, or ### litres + ParameterInfo("CARGO_TINY", [P__, PP_], False, True ), # tiny cargo description with only the amount + ParameterInfo("CARGO_LIST", [P__], True, True ), + ParameterInfo("POWER", [PP_], False, True ), + ParameterInfo("VOLUME_LONG", [PP_], False, True ), + ParameterInfo("VOLUME_SHORT", [PP_], False, True ), + ParameterInfo("WEIGHT_LONG", [PP_], False, True ), + ParameterInfo("WEIGHT_SHORT", [PP_], False, True ), + ParameterInfo("FORCE", [PP_], False, True ), + ParameterInfo("VELOCITY", [PP_], False, True ), + ParameterInfo("HEIGHT", [PP_], False, True ), + ParameterInfo("DATE_TINY", [P__], False, True ), + ParameterInfo("DATE_SHORT", [P__], True, True ), + ParameterInfo("DATE_LONG", [P__], True, True ), + ParameterInfo("DATE_ISO", [P__], False, True ), - ParameterInfo("STRING", True, True, True, True, True ), - ParameterInfo("RAW_STRING", True, True, True, False, True, "STRING"), + ParameterInfo("STRING", [P_G], True, True ), + ParameterInfo("RAW_STRING", [P_G], False, True, "STRING"), - ParameterInfo("COMMA", True, True, False, False, True ), # Number with comma - ParameterInfo("DECIMAL", True, True, False, False, True ), # Number with comma and fractional part. - ParameterInfo("NUM", True, True, False, False, True ), # Signed number - ParameterInfo("ZEROFILL_NUM", True, True, False, False, True ), # Unsigned number with zero fill, e.g. "02". - ParameterInfo("BYTES", True, True, False, False, True ), # Unsigned number with "bytes", i.e. "1.02 MiB or 123 KiB" - ParameterInfo("HEX", True, True, False, False, True ), # Hexadecimally printed number + ParameterInfo("COMMA", [PP_], False, True ), # Number with comma + ParameterInfo("DECIMAL", [PP_, P__], False, True ), # Number with comma and fractional part. + ParameterInfo("NUM", [PP_], False, True ), # Signed number + ParameterInfo("ZEROFILL_NUM", [PP_, P__], False, True ), # Unsigned number with zero fill, e.g. "02". + ParameterInfo("BYTES", [PP_], False, True ), # Unsigned number with "bytes", i.e. "1.02 MiB or 123 KiB" + ParameterInfo("HEX", [PP_], False, True ), # Hexadecimally printed number - ParameterInfo("CURRENCY_LONG", True, True, False, False, True ), - ParameterInfo("CURRENCY_SHORT", True, True, False, False, True ), # compact currency + ParameterInfo("CURRENCY_LONG", [PP_], False, True ), + ParameterInfo("CURRENCY_SHORT", [PP_], False, True ), # compact currency - ParameterInfo("WAYPOINT", True, False, True, False, True ), # waypoint name - ParameterInfo("STATION", True, False, True, False, True ), - ParameterInfo("DEPOT", True, False, True, False, True ), - ParameterInfo("TOWN", True, False, True, False, True ), - ParameterInfo("GROUP", True, False, True, False, True ), - ParameterInfo("SIGN", True, False, True, False, True ), - ParameterInfo("ENGINE", True, False, True, False, True ), - ParameterInfo("VEHICLE", True, False, True, False, True ), - ParameterInfo("COMPANY", True, False, True, False, True ), - ParameterInfo("COMPANY_NUM", True, False, False, False, True ), - ParameterInfo("PRESIDENT_NAME", True, False, True, False, True ), + ParameterInfo("WAYPOINT", [P_G], False, True ), # waypoint name + ParameterInfo("STATION", [P_G], False, True ), + ParameterInfo("DEPOT", [P_G, P__], False, True ), + ParameterInfo("TOWN", [P_G], False, True ), + ParameterInfo("GROUP", [P_G], False, True ), + ParameterInfo("SIGN", [P_G], False, True ), + ParameterInfo("ENGINE", [P_G], False, True ), + ParameterInfo("VEHICLE", [P_G], False, True ), + ParameterInfo("COMPANY", [P_G], False, True ), + ParameterInfo("COMPANY_NUM", [P__], False, True ), + ParameterInfo("PRESIDENT_NAME", [P_G], False, True ), - ParameterInfo("TRAIN", False, False, False, False, True ), - ParameterInfo("LORRY", False, False, False, False, True ), - ParameterInfo("BUS", False, False, False, False, True ), - ParameterInfo("PLANE", False, False, False, False, True ), - ParameterInfo("SHIP", False, False, False, False, True ), - ParameterInfo("NBSP", False, False, False, False, False), - ParameterInfo("COPYRIGHT", False, False, False, False, True ), + ParameterInfo("TRAIN", [], False, True ), + ParameterInfo("LORRY", [], False, True ), + ParameterInfo("BUS", [], False, True ), + ParameterInfo("PLANE", [], False, True ), + ParameterInfo("SHIP", [], False, True ), + ParameterInfo("NBSP", [], False, False), + ParameterInfo("COPYRIGHT", [], False, True ), # The following are directional formatting codes used to get the RTL strings right: # http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes - ParameterInfo("LRM", False, False, False, False, False), - ParameterInfo("RLM", False, False, False, False, False), - ParameterInfo("LRE", False, False, False, False, False), - ParameterInfo("RLE", False, False, False, False, False), - ParameterInfo("LRO", False, False, False, False, False), - ParameterInfo("RLO", False, False, False, False, False), - ParameterInfo("PDF", False, False, False, False, False), + ParameterInfo("LRM", [], False, False), + ParameterInfo("RLM", [], False, False), + ParameterInfo("LRE", [], False, False), + ParameterInfo("RLE", [], False, False), + ParameterInfo("LRO", [], False, False), + ParameterInfo("RLO", [], False, False), + ParameterInfo("PDF", [], False, False), ] GS_PARAMETERS = dict((x.literal, x) for x in _GS_PARAMETERS) @@ -300,25 +321,25 @@ # Some string parameters are only allowed in the OpenTTD project. # While they technically also work in Game Scripts, disencourage the usage. # This also includes the "sprite" characters. - ParameterInfo("REV", False, False, False, False, True ), - ParameterInfo("STATION_FEATURES", True, False, False, False, True ), # station features string, icons of the features - ParameterInfo("UP_ARROW", False, False, False, False, True ), - ParameterInfo("SMALL_UP_ARROW", False, False, False, False, True ), - ParameterInfo("SMALL_DOWN_ARROW", False, False, False, False, True ), - ParameterInfo("DOWN_ARROW", False, False, False, False, True ), - ParameterInfo("CHECKMARK", False, False, False, False, True ), - ParameterInfo("CROSS", False, False, False, False, True ), - ParameterInfo("RIGHT_ARROW", False, False, False, False, False), - ParameterInfo("SMALL_LEFT_ARROW", False, False, False, False, False), - ParameterInfo("SMALL_RIGHT_ARROW", False, False, False, False, False), + ParameterInfo("REV", [], False, True ), + ParameterInfo("STATION_FEATURES", [P__], False, True ), # station features string, icons of the features + ParameterInfo("UP_ARROW", [], False, True ), + ParameterInfo("SMALL_UP_ARROW", [], False, True ), + ParameterInfo("SMALL_DOWN_ARROW", [], False, True ), + ParameterInfo("DOWN_ARROW", [], False, True ), + ParameterInfo("CHECKMARK", [], False, True ), + ParameterInfo("CROSS", [], False, True ), + ParameterInfo("RIGHT_ARROW", [], False, False), # left/right arrows are not critical due to LTR/RTL languages + ParameterInfo("SMALL_LEFT_ARROW", [], False, False), + ParameterInfo("SMALL_RIGHT_ARROW", [], False, False), ] OPENTTD_PARAMETERS = dict((x.literal, x) for x in _OPENTTD_PARAMETERS) OPENTTD_PARAMETERS.update((x.literal, x) for x in _GS_PARAMETERS) # }}} -NL_PARAMETER = ParameterInfo("", False, False, False, False, False) -CURLY_PARAMETER = ParameterInfo("{", False, False, False, False, False) +NL_PARAMETER = ParameterInfo("", [], False, False) +CURLY_PARAMETER = ParameterInfo("{", [], False, False) # Available project types, ordered by internal name.
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever