Class: OpenTTDLib
Source Location: /includes/OpenTTDLib.php
OpenTTDLib a php class to query a running OpenTTD server
Author(s):
|
|
|
|
Class Details
Class Variables
Class Methods
constructor __construct [line 254]
prepares the class with certain variables and values
Tags:
method checkTimeout [line 477]
check if we have timedout
Tags:
method clear [line 1066]
void clear(
[boolean
$all = false])
|
|
clears internal variables to be able to start a new query
Tags:
Parameters:
method clearOption [line 438]
void clearOption(
[mixed
$option = null])
|
|
reset any previously set option - has to be called manually, this method is not called from within the class
Tags:
Parameters:
method connect [line 268]
boolan connect(
[string
$host = null], [integer
$port = null])
|
|
Connect to a given IP/Port
Tags:
Parameters:
method convertMapSet [line 1446]
mixed convertMapSet(
[mixed
$value = null])
|
|
converts the numbers to the appropriate mapset names and vise versa
Tags:
Parameters:
method convertNetLang [line 1434]
mixed convertNetLang(
[mixed
$value = null])
|
|
converts the numbers to the appropriate server language names and vise versa
Tags:
Parameters:
method convertStationType [line 1470]
mixed convertStationType(
[mixed
$value = null])
|
|
converts the numbers to the appropriate station type names and vise versa
Tags:
Parameters:
method convertVehicleType [line 1458]
mixed convertVehicleType(
[mixed
$value = null])
|
|
converts the numbers to the appropriate vehicle type names and vise versa
Tags:
Parameters:
method Date2YMD [line 1265]
array Date2YMD(
integer
$date)
|
|
Converts OpenTTD Date to YMD (tnx to WizKid for converting)
Tags:
Parameters:
method disconnect [line 303]
Disconnect from the server, but only if a connection is still open
Tags:
method getCache [line 1139]
method getDetail [line 1168]
convert $this->detail and return
Tags:
method getInfo [line 1150]
Get's the info (if any) from the internal buffer
Tags:
method getNewGrf [line 1186]
array getNewGrf(
[
$sort = false])
|
|
get the new grf details
Tags:
Parameters:
method getOption [line 412]
mixed getOption(
string
$option)
|
|
get an option previously set with OpenTTDLib::setOption() or the respective default value check if $option is a valid option and return it's value if set, otherwise return the options default
Tags:
Parameters:
method getPacket [line 1122]
get the instance of OpenTTDLibPacket which is holding the received packet data
Tags:
method hasInfo [line 1243]
check there is info on the internal buffer
Tags:
method initCache [line 325]
method isConnected [line 1112]
Checks if a connection is available
Tags:
method isLeapYear [line 1254]
boolean isLeapYear(
integer
$year)
|
|
calculate if $year is a leapyear
Tags:
Parameters:
method processPacket [line 1027]
process the packet data accoding to the packet type we received
Tags:
method queryServer [line 1652]
boolean queryServer(
[string
$host = null], [integer
$port = null], [array
$options = array()])
|
|
provides a simple way to query a server, this method will handle the rest for you after this method returns, you either can fetch processed response packets from the server or an error message
Tags:
Parameters:
method RecvData [line 976]
Try to receive some data, on success a new OpenTTDLibPacket Object will be stored in $this->packet
Tags:
method sendPacket [line 1091]
Send a packet
Tags:
Parameters:
method setOption [line 366]
method startTimer [line 466]
start the internal timer for checking if a timeout has occured
Tags:
method updateCache [line 341]
save the cache to it's file, if options are set, and $this->_cache is an instance of OpenTTDLibCache
Tags:
Class Constants
OPTION_CACHE_FILE = 'CACHE_FILE'
[line 60]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_CACHE_GAME = 'CACHE_GAME'
[line 59]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_CACHE_NEWGRF = 'CACHE_NEWGRF'
[line 58]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_CACHE_UPDATE = 'CACHE_UPDATE'
[line 61]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_CONVERT_MAPSET = 'CONVERT_MAPSET'
[line 51]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_CONVERT_NETLANG = 'CONVERT_NETLANG'
[line 52]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_CONVERT_STATIONTYPE = 'CONVERT_STATIONTYPE'
[line 54]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_CONVERT_VEHICLETYPE = 'CONVERT_VEHICLETYPE'
[line 53]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_DEFAULT_CACHE_FILE = 'cache.xml'
[line 80]
respective default values to the options
OPTION_DEFAULT_CACHE_GAME = false
[line 79]
respective default values to the options
OPTION_DEFAULT_CACHE_NEWGRF = true
[line 78]
respective default values to the options
OPTION_DEFAULT_CACHE_UPDATE = true
[line 81]
respective default values to the options
OPTION_DEFAULT_CONVERT_MAPSET = false
[line 71]
respective default values to the options
OPTION_DEFAULT_CONVERT_NETLANG = false
[line 72]
respective default values to the options
OPTION_DEFAULT_CONVERT_STATIONTYPE = false
[line 74]
respective default values to the options
OPTION_DEFAULT_CONVERT_VEHICLETYPE = false
[line 73]
respective default values to the options
OPTION_DEFAULT_NEWGRF_MAX_REQUEST = 10
[line 76]
respective default values to the options
OPTION_DEFAULT_QUERYTYPE = self::QUERYTYPE_ALL
[line 84]
respective default values to the options
OPTION_DEFAULT_RETURNTYPE = self::RETURNTYPE_OBJECT
[line 83]
respective default values to the options
OPTION_DEFAULT_TIMEOUT = 5
[line 85]
respective default values to the options
OPTION_NEWGRF_MAX_REQUEST = 'NEWGRF_MAX_REQUEST'
[line 56]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_QUERYTYPE = 'QUERYTYPE'
[line 64]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_RETURNTYPE = 'RETURNTYPE'
[line 63]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
OPTION_TIMEOUT = 'TIMEOUT'
[line 65]
Option constants, use with OpenTTDLib::setOption() and OpenTTDLib::getOption()
QUERYTYPE_ALL = 0
[line 38]
Query Method
Tags:
QUERYTYPE_DETAIL = 2
[line 40]
Query Method
Tags:
QUERYTYPE_INFO = 1
[line 39]
Query Method
Tags:
QUERYTYPE_NEWGRF = 3
[line 41]
Query Method
Tags:
RETURNTYPE_ARRAY = 0
[line 44]
RETURNTYPE_OBJECT = 1
[line 45]
|
|