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
/** * Height map. * The data structure is used at many places, it contains requirements from all its users. * The tgp Perlin map generator is a more demanding user. */ struct HeightMap { HeightMap(); ~HeightMap(); /** Fixed point type for heights, required by Perlin map generator tgp. */ typedef int16 height_t; height_t *h; //< Array of heights (#size_x + 1) * (#size_y + 1). /* (from tgp) Even though the sizes are always positive, there are many cases where * X and Y need to be signed integers due to subtractions. */ uint dim_x; //< Line length #size_x + 1. uint total_size; //< height map total size uint map_size; //< Number of tiles in the map. uint size_x; //< Size of the map in X direction. uint size_y; //< Size of the map in Y direction. uint log_x; //< 2log of #size_x. uint log_y; //< 2log of #size_y. /** * Get the size of the map in X direction. * @return The size of the map in X direction. */ inline int MapSizeX() const { return this->size_x; } /** * Get the size of the map in Y direction. * @return The size of the map in Y direction. */ inline int MapSizeY() const { return this->size_y; } /** * Get the number of tiles in the map. * @return Number of files in the map. */ inline int MapSize() const { return this->map_size; } /** * Is the given coordinate valid as map coordinate? * @param x X coordinate. * @param y Y coordinate. * @return Whether the indicated position in on the map. */ inline bool IsValidXY(int x, int y) const { return x >= 0 && x < (int)this->MapSizeX() && y >= 0 && y < (int)this->MapSizeY(); } /** * Get biggest coordinate of the map in X direction. * @return The biggest coordinate of the map in X direction. */ inline int MapMaxX() const { return this->size_x - 1; } /** * Get biggest coordinate of the map in Y direction. * @return The biggest coordinate of the map in Y direction. */ inline int MapMaxY() const { return this->size_y - 1; } /** * Get the number of bits needed for storing an X coordinate. * @return Number of bits needed for storing an X coordinate. */ inline int MapLogX() const { return this->log_x; } /** * Get the number of bits needed for storing an Y coordinate. * @return Number of bits needed for storing an Y coordinate. */ inline int MapLogY() const { return this->log_y; } /** * Scales the given value by the map size, where the given value is for a 256 by 256 map. * @param n the value to scale. * @return the scaled size. */ inline uint ScaleByMapSize(uint n) const { /* Subtract 12 from shift in order to prevent integer overflow * for large values of n. It's safe since the min mapsize is 64x64. */ return CeilDiv(n << (this->MapLogX() + this->MapLogY() - 12), 1 << 4); } /** * Height map access (both read and write). * @param x X position. * @param y Y position. * @return height data. */ inline height_t &Height(uint x, uint y) { return this->h[x + y * this->dim_x]; } /** * Get height of the map at a given position. * @param x X position. * @param y Y position. * @return height data. */ inline height_t Height(uint x, uint y) const { return this->h[x + y * this->dim_x]; } void Setup(uint size_x, uint size_y, HeightMap::height_t initial_height); void FixSlopes(); void CopyToGlobalMap(); };
Mark as private
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
forever