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/road_map.h b/src/road_map.h index ca233ad..e456466 100644 --- a/src/road_map.h +++ b/src/road_map.h @@ -159,38 +159,6 @@ static inline void SetRoadBits(TileIndex t, RoadBits r, RoadType rt) } /** - * Get the present road types of a tile. - * @param t The tile to query. - * @return Present road types. - */ -static inline RoadTypes GetRoadTypes(TileIndex t) -{ - return (RoadTypes)GB(_me[t].m7, 6, 2); -} - -/** - * Set the present road types of a tile. - * @param t The tile to change. - * @param rt The new road types. - */ -static inline void SetRoadTypes(TileIndex t, RoadTypes rt) -{ - assert(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE)); - SB(_me[t].m7, 6, 2, rt); -} - -/** - * Check if a tile has a specific road type. - * @param t The tile to check. - * @param rt Road type to check. - * @return True if the tile has the specified road type. - */ -static inline bool HasTileRoadType(TileIndex t, RoadType rt) -{ - return HasBit(GetRoadTypes(t), rt); -} - -/** * Get the owner of a specific road type. * @param t The tile to query. * @param rt The road type to get the owner of. @@ -565,24 +533,8 @@ struct RoadTypeIdentifiers { assert(IsTileType(t, MP_ROAD) || IsTileType(t, MP_STATION) || IsTileType(t, MP_TUNNELBRIDGE)); RoadTypeIdentifiers rtids; - - switch (GetTileType(t)) { - default: NOT_REACHED(); - case MP_ROAD: - if (HasTileRoadType(t, ROADTYPE_ROAD)) { - rtids.road_identifier = GetRoadTypeRoad(t); - } - - if (HasTileRoadType(t, ROADTYPE_TRAM)) { - rtids.tram_identifier = GetRoadTypeTram(t); - } - break; - case MP_STATION: /* TODO */ - case MP_TUNNELBRIDGE: - rtids.road_identifier = GetRoadTypeRoad(t); - rtids.tram_identifier = GetRoadTypeTram(t); - break; - } + rtids.road_identifier = GetRoadTypeRoad(t); + rtids.tram_identifier = GetRoadTypeTram(t); return rtids; } @@ -714,15 +666,8 @@ static inline RoadTypeIdentifiers CombineTileRoadTypeIds(TileIndex tile, RoadTyp */ static inline void SetRoadTypes(TileIndex t, RoadTypeIdentifiers rtids) { - SetRoadTypes(t, rtids.PresentRoadTypes()); - - if (rtids.road_identifier.IsValid()) { - SB(_m[t].m4, 0, 4, rtids.road_identifier.subtype); - } - - if (rtids.tram_identifier.IsValid()) { - SB(_m[t].m4, 4, 4, rtids.tram_identifier.subtype); - } + SB(_m[t].m4, 0, 4, rtids.road_identifier.subtype); + SB(_m[t].m4, 4, 4, rtids.tram_identifier.subtype); } static inline bool HasRoadTypeRoad(TileIndex t) @@ -764,16 +709,17 @@ static inline bool HasRoadTypeTram(RoadTypeIdentifiers rtids) * @param road New owner of road. * @param tram New owner of tram tracks. */ -static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, TownID town, Owner road, Owner tram) +static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypeIdentifier rtid, TownID town, Owner road, Owner tram) { SetTileType(t, MP_ROAD); SetTileOwner(t, road); _m[t].m2 = town; - _m[t].m3 = (HasBit(rot, ROADTYPE_TRAM) ? bits : 0); + _m[t].m3 = rtid.IsTram() ? bits : 0); _m[t].m4 = 0; - _m[t].m5 = (HasBit(rot, ROADTYPE_ROAD) ? bits : 0) | ROAD_TILE_NORMAL << 6; + _m[t].m5 = (rtid.IsRoad() ? bits : 0) | ROAD_TILE_NORMAL << 6; SB(_me[t].m6, 2, 4, 0); - _me[t].m7 = rot << 6; + _me[t].m7 = 0; + SetRoadTypes(RoadTypeIdentifiers::FromRoadTypeIdentifier(rtid)); SetRoadOwner(t, ROADTYPE_TRAM, tram); } @@ -788,7 +734,7 @@ static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, Tow * @param rot New present road types. * @param town Town ID if the road is a town-owned road. */ -static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadTypes rot, uint town) +static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner rail, Axis roaddir, RailType rat, RoadTypeIdentifier rtid, uint town) { SetTileType(t, MP_ROAD); SetTileOwner(t, rail); @@ -797,7 +743,8 @@ static inline void MakeRoadCrossing(TileIndex t, Owner road, Owner tram, Owner r _m[t].m4 = 0; _m[t].m5 = ROAD_TILE_CROSSING << 6 | roaddir; SB(_me[t].m6, 2, 4, 0); - _me[t].m7 = rot << 6 | road; + _me[t].m7 = road; + SetRoadTypes(RoadTypeIdentifiers::FromRoadTypeIdentifier(rtid)); SetRoadOwner(t, ROADTYPE_TRAM, tram); } @@ -818,7 +765,7 @@ static inline void MakeRoadDepot(TileIndex t, Owner owner, DepotID did, DiagDire _m[t].m4 = 0; _m[t].m5 = ROAD_TILE_DEPOT << 6 | dir; SB(_me[t].m6, 2, 4, 0); - _me[t].m7 = RoadTypeToRoadTypes(rtid.basetype) << 6 | owner; + _me[t].m7 = owner; SetRoadOwner(t, ROADTYPE_TRAM, owner); SetRoadTypes(t, RoadTypeIdentifiers::FromRoadTypeIdentifier(rtid)); } @@ -838,11 +785,11 @@ static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypeIdentifier SetTileOwner(t, road); _m[t].m2 = town; _m[t].m3 = (rtid.basetype == ROADTYPE_TRAM ? bits : 0); - SetRoadTypes(t, RoadTypeIdentifiers::FromRoadTypeIdentifier(rtid)); _m[t].m5 = (rtid.basetype == ROADTYPE_ROAD ? bits : 0) | ROAD_TILE_NORMAL << 6; SB(_me[t].m6, 2, 4, 0); - _me[t].m7 = RoadTypeToRoadTypes(rtid.basetype) << 6; + _me[t].m7 = 0; SetRoadOwner(t, ROADTYPE_TRAM, tram); + SetRoadTypes(t, RoadTypeIdentifiers::FromRoadTypeIdentifier(rtid)); } #endif /* ROAD_MAP_H */
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever