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
Index: src/economy_func.h =================================================================== --- src/economy_func.h (revision 27929) +++ src/economy_func.h (working copy) @@ -31,7 +31,7 @@ void StartupIndustryDailyChanges(bool init_counter); Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type); -uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations); +uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations, bool oil_rig = false); void PrepareUnload(Vehicle *front_v); void LoadUnloadStation(Station *st); Index: src/industry_cmd.cpp =================================================================== --- src/industry_cmd.cpp (revision 27929) +++ src/industry_cmd.cpp (working copy) @@ -390,7 +390,7 @@ return FlatteningFoundation(tileh); } -static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted) +static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted, bool oil_rig) { IndustryGfx gfx = GetIndustryGfx(tile); const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx); @@ -423,6 +423,8 @@ 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 (oil_rig && (GetIndustrySpec(ind->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) == 0) continue; + if (!oil_rig && (GetIndustrySpec(ind->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0) continue; /* Add accepted cargo */ acceptance[a] += cargo_acceptance[i]; @@ -495,6 +497,7 @@ { Industry *i = Industry::GetByTile(tile); const IndustrySpec *indspec = GetIndustrySpec(i->type); + bool oil_rig = (indspec->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0; bool moved_cargo = false; StationFinder stations(i->location); @@ -509,7 +512,7 @@ i->this_month_production[j] += cw; - uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, stations.GetStations()); + uint am = MoveGoodsToStation(i->produced_cargo[j], cw, ST_INDUSTRY, i->index, stations.GetStations(), oil_rig); i->this_month_transported[j] += am; moved_cargo |= (am != 0); Index: src/object_cmd.cpp =================================================================== --- src/object_cmd.cpp (revision 27929) +++ src/object_cmd.cpp (working copy) @@ -540,9 +540,10 @@ return cost; } -static void AddAcceptedCargo_Object(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted) +static void AddAcceptedCargo_Object(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted, bool oil_rig) { if (!IsObjectType(tile, OBJECT_HQ)) return; + if (oil_rig) return; /* HQ accepts passenger and mail; but we have to divide the values * between 4 tiles it occupies! */ Index: src/station_cmd.cpp =================================================================== --- src/station_cmd.cpp (revision 27929) +++ src/station_cmd.cpp (working copy) @@ -506,6 +506,7 @@ const Industry *i; FOR_ALL_INDUSTRIES(i) { if (!ta.Intersects(i->location)) continue; + if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER)) continue; for (uint j = 0; j < lengthof(i->produced_cargo); j++) { CargoID cargo = i->produced_cargo[j]; @@ -524,7 +525,7 @@ * @param rad Search radius in addition to given area * @param always_accepted bitmask of cargo accepted by houses and headquarters; can be NULL */ -CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted) +CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted, bool oil_rig) { CargoArray acceptance; if (always_accepted != NULL) *always_accepted = 0; @@ -547,7 +548,7 @@ for (int yc = y1; yc != y2; yc++) { for (int xc = x1; xc != x2; xc++) { TileIndex tile = TileXY(xc, yc); - AddAcceptedCargo(tile, acceptance, always_accepted); + AddAcceptedCargo(tile, acceptance, always_accepted, oil_rig); } } @@ -572,7 +573,8 @@ st->rect.right - st->rect.left + 1, st->rect.bottom - st->rect.top + 1, st->GetCatchmentRadius(), - &st->always_accepted + &st->always_accepted, + IsOilRig(st->xy) ); } @@ -3832,7 +3834,7 @@ return &this->stations; } -uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations) +uint MoveGoodsToStation(CargoID type, uint amount, SourceType source_type, SourceID source_id, const StationList *all_stations, bool oil_rig) { /* Return if nothing to do. Also the rounding below fails for 0. */ if (amount == 0) return 0; @@ -3846,7 +3848,7 @@ Station *st = *st_iter; /* Is the station reserved exclusively for somebody else? */ - if (st->town->exclusive_counter > 0 && st->town->exclusivity != st->owner) continue; + if (!oil_rig && st->town->exclusive_counter > 0 && st->town->exclusivity != st->owner) continue; if (st->goods[type].rating == 0) continue; // Lowest possible rating, better not to give cargo anymore @@ -3858,6 +3860,10 @@ if (st->facilities == FACIL_BUS_STOP) continue; // non-passengers are never served by just a bus stop } + if (oil_rig && !IsOilRig(st->xy)) continue; // Oil rig cargo is served by none other than Oil Rigs' own stations. + + if (!oil_rig && IsOilRig(st->xy)) continue; // Cargo not originated from Oil Rigs are never served by Oil Rigs' own stations. + /* This station can be used, add it to st1/st2 */ if (st1 == NULL || st->goods[type].rating >= best_rating1) { st2 = st1; best_rating2 = best_rating1; st1 = st; best_rating1 = st->goods[type].rating; Index: src/station_func.h =================================================================== --- src/station_func.h (revision 27929) +++ src/station_func.h (working copy) @@ -28,7 +28,7 @@ void UpdateAllStationVirtCoords(); CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad); -CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted = NULL); +CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted = NULL, bool oil_rig = false); void UpdateStationAcceptance(Station *st, bool show_msg); Index: src/tile_cmd.h =================================================================== --- src/tile_cmd.h (revision 27929) +++ src/tile_cmd.h (working copy) @@ -81,7 +81,7 @@ * @param acceptance Storage destination of the cargo acceptance in 1/8 * @param always_accepted Bitmask of always accepted cargo types */ -typedef void AddAcceptedCargoProc(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted); +typedef void AddAcceptedCargoProc(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted, bool oil_rig); /** * Tile callback function signature for obtaining a tile description @@ -165,12 +165,12 @@ void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner); void GetTileDesc(TileIndex tile, TileDesc *td); -static inline void AddAcceptedCargo(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted) +static inline void AddAcceptedCargo(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted, bool oil_rig = false) { AddAcceptedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_accepted_cargo_proc; if (proc == NULL) return; uint32 dummy = 0; // use dummy bitmask so there don't need to be several 'always_accepted != NULL' checks - proc(tile, acceptance, always_accepted == NULL ? &dummy : always_accepted); + proc(tile, acceptance, always_accepted == NULL ? &dummy : always_accepted, oil_rig); } static inline void AddProducedCargo(TileIndex tile, CargoArray &produced) Index: src/town_cmd.cpp =================================================================== --- src/town_cmd.cpp (revision 27929) +++ src/town_cmd.cpp (working copy) @@ -601,14 +601,15 @@ } } -static inline void AddAcceptedCargoSetMask(CargoID cargo, uint amount, CargoArray &acceptance, uint32 *always_accepted) +static inline void AddAcceptedCargoSetMask(CargoID cargo, uint amount, CargoArray &acceptance, uint32 *always_accepted, bool oil_rig = false) { if (cargo == CT_INVALID || amount == 0) return; + if (oil_rig) return; acceptance[cargo] += amount; SetBit(*always_accepted, cargo); } -static void AddAcceptedCargo_Town(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted) +static void AddAcceptedCargo_Town(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted, bool oil_rig = false) { const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile)); CargoID accepts[3];
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever