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 --git a/src/newgrf_roadtype.cpp b/src/newgrf_roadtype.cpp index ddacaaf..64eaeca 100644 --- a/src/newgrf_roadtype.cpp +++ b/src/newgrf_roadtype.cpp @@ -131,7 +131,7 @@ uint8 GetReverseRoadTypeTranslation(RoadTypeIdentifier rti, const GRFFile *grffi if (grffile == NULL || grffile->roadtype_list.Length() == 0) return rti.subtype; /* Look for a matching road type label in the table */ - RoadTypeLabel label = GetRoadTypeInfo(rti.Pack())->label; + RoadTypeLabel label = GetRoadTypeInfo(rti)->label; int index = grffile->roadtype_list.FindIndex(label); if (index >= 0) return index; diff --git a/src/road.cpp b/src/road.cpp index 29337f5..c4a5a83 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -169,7 +169,7 @@ RoadTypeIdentifier GetRoadTypeByLabel(RoadTypeLabel label, RoadType basetype, bo /* Loop through each road type until the label is found */ for (RoadSubType r = ROADSUBTYPE_BEGIN; r != ROADSUBTYPE_END; r++) { rtid.subtype = r; - const RoadtypeInfo *rti = GetRoadTypeInfo(rtid.Pack()); + const RoadtypeInfo *rti = GetRoadTypeInfo(rtid); if (rti->label == label) return rtid; } @@ -177,7 +177,7 @@ RoadTypeIdentifier GetRoadTypeByLabel(RoadTypeLabel label, RoadType basetype, bo /* Test if any road type defines the label as an alternate. */ for (RoadSubType r = ROADSUBTYPE_BEGIN; r != ROADSUBTYPE_END; r++) { rtid.subtype = r; - const RoadtypeInfo *rti = GetRoadTypeInfo(rtid.Pack()); + const RoadtypeInfo *rti = GetRoadTypeInfo(rtid); if (rti->alternate_labels.Contains(label)) return rtid; } } @@ -222,4 +222,4 @@ RoadTypeIdentifier::RoadTypeIdentifier(uint8 data) { bool ret = this->Unpack(data); assert(ret); -} \ No newline at end of file +} diff --git a/src/road.h b/src/road.h index 6feb34a..dbc8be6 100644 --- a/src/road.h +++ b/src/road.h @@ -216,7 +216,7 @@ struct RoadTypeIdentifier { bool IsTram(); RoadTypeIdentifier(RoadType basetype, RoadSubType subtype) : basetype(basetype), subtype(subtype) {} - RoadTypeIdentifier(uint8 data = 0); + explicit RoadTypeIdentifier(uint8 data); }; /** diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index bc45cb9..e56450e 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -638,7 +638,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 /* do not allow building 'zero' road bits, code wouldn't handle it */ if (pieces == ROAD_NONE) return CMD_ERROR; - RoadTypeIdentifier rtid = GB(p1, 4, 5); + RoadTypeIdentifier rtid(GB(p1, 4, 5)); RoadType rt = rtid.basetype; if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR; @@ -1886,13 +1886,13 @@ static void GetTileDesc_Road(TileIndex tile, TileDesc *td) const RoadtypeInfo *rti; if (rtids.road_identifier.IsValid()) { - rti = GetRoadTypeInfo(rtids.road_identifier.Pack()); + rti = GetRoadTypeInfo(rtids.road_identifier); td->str = rti->strings.menu_text; // TODO: roadside strings from grf road_owner = GetRoadOwner(tile, ROADTYPE_ROAD); } if (rtids.tram_identifier.IsValid()) { - rti = GetRoadTypeInfo(rtids.tram_identifier.Pack()); + rti = GetRoadTypeInfo(rtids.tram_identifier); td->str = rti->strings.menu_text; // TODO: roadside strings from grf tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM); } diff --git a/src/road_func.h b/src/road_func.h index ee6665e..ecb28ea 100644 --- a/src/road_func.h +++ b/src/road_func.h @@ -179,7 +179,7 @@ static inline Money RoadMaintenanceCost(RoadType roadtype, uint32 num) static inline bool HasCatenary(RoadTypeIdentifier rti) { assert(IsValidRoadType(rti.basetype)); - return HasBit(GetRoadTypeInfo(rti.Pack())->flags, ROTF_CATENARY); + return HasBit(GetRoadTypeInfo(rti)->flags, ROTF_CATENARY); } bool HasRoadTypesAvail(const CompanyID company, const RoadTypes rts); diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 25c3190..8907269 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -334,9 +334,9 @@ struct BuildRoadToolbarWindow : Window { * Switch to another road type. * @param roadtype New road type. */ - void ModifyRoadType(RoadType roadtype) + void ModifyRoadType(RoadTypeIdentifier roadtype_identifier) { - this->SetupRoadToolbar(roadtype); + this->SetupRoadToolbar(roadtype_identifier); this->ReInit(); } @@ -847,7 +847,7 @@ Window *ShowBuildRoadScenToolbar() { _cur_roadtype_identifier = RoadTypeIdentifier(ROADTYPE_ROAD, ROADSUBTYPE_BEGIN); //return AllocateWindowDescFront<BuildRoadToolbarWindow>(&_build_road_scen_desc, TRANSPORT_ROAD); - return new BuildRoadToolbarWindow(&_build_road_scen_desc, ROADTYPE_ROAD); + return new BuildRoadToolbarWindow(&_build_road_scen_desc, RoadTypeIdentifier(ROADTYPE_ROAD, ROADSUBTYPE_BEGIN)); // TODO which roadtype? } struct BuildRoadDepotWindow : public PickerWindowBase { @@ -1117,7 +1117,7 @@ void InitializeRoadGui() void InitializeRoadGUI() { BuildRoadToolbarWindow *w = dynamic_cast<BuildRoadToolbarWindow *>(FindWindowById(WC_BUILD_TOOLBAR, TRANSPORT_ROAD)); - if (w != NULL) w->ModifyRoadType(_cur_roadtype_identifier.basetype); + if (w != NULL) w->ModifyRoadType(_cur_roadtype_identifier); } DropDownList *GetRoadTypeDropDownList(RoadType roadtype) diff --git a/src/road_map.h b/src/road_map.h index 73f817d..f4ce73c 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -770,11 +770,11 @@ struct RoadTypeIdentifiers { bool HasCatenary() { - if (road_identifier.IsValid() && GetRoadTypeInfo(road_identifier.Pack())->flags & ROTFB_CATENARY) { + if (road_identifier.IsValid() && GetRoadTypeInfo(road_identifier)->flags & ROTFB_CATENARY) { return true; } - if (tram_identifier.IsValid() && GetRoadTypeInfo(tram_identifier.Pack())->flags & ROTFB_CATENARY) { + if (tram_identifier.IsValid() && GetRoadTypeInfo(tram_identifier)->flags & ROTFB_CATENARY) { return true; }
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever