OpenTTD GameScript API  20240725-master-g44b748a766
Public Types | Static Public Member Functions
GSClient Class Reference

Class that handles all client related functions. More...

Inheritance diagram for GSClient:

Public Types

enum  ClientID : int {
  CLIENT_INVALID,
  CLIENT_SERVER,
  CLIENT_FIRST
}
 Different constants related to ClientID. More...
 

Static Public Member Functions

static ClientID ResolveClientID (ClientID client)
 Resolves the given client id to the correct index for the client. More...
 
static string GetName (ClientID client)
 Get the name of the given client. More...
 
static GSCompany::CompanyID GetCompany (ClientID client)
 Get the company in which the given client is playing. More...
 
static GSDate::Date GetJoinDate (ClientID client)
 Get the economy-date when the given client has joined. More...
 

Detailed Description

Class that handles all client related functions.

Member Enumeration Documentation

◆ ClientID

enum GSClient::ClientID : int

Different constants related to ClientID.

Enumerator
CLIENT_INVALID 

Client is not part of anything.

CLIENT_SERVER 

Servers always have this ID.

CLIENT_FIRST 

The first client ID.

Member Function Documentation

◆ GetCompany()

static GSCompany::CompanyID GSClient::GetCompany ( ClientID  client)
static

Get the company in which the given client is playing.

Parameters
clientThe client to get company for.
Precondition
ResolveClientID(client) != CLIENT_INVALID.
Returns
The company in which client is playing or COMPANY_SPECTATOR.

◆ GetJoinDate()

static GSDate::Date GSClient::GetJoinDate ( ClientID  client)
static

Get the economy-date when the given client has joined.

Parameters
clientThe client to get joining date for.
Precondition
ResolveClientID(client) != CLIENT_INVALID.
Returns
The economy-date when client has joined.
See also
GSEconomyTime

◆ GetName()

static string GSClient::GetName ( ClientID  client)
static

Get the name of the given client.

Parameters
clientThe client to get the name for.
Precondition
ResolveClientID(client) != CLIENT_INVALID.
Returns
The name of the given client.

◆ ResolveClientID()

static ClientID GSClient::ResolveClientID ( ClientID  client)
static

Resolves the given client id to the correct index for the client.

If the client with the given id does not exist it will return CLIENT_INVALID.

Parameters
clientThe client id to resolve.
Returns
The resolved client id.