OpenTTD GameScript API 20260208-master-g43af8e94d0
GSViewport Class Reference

Class that manipulates the user's viewport. More...

#include <script_viewport.hpp>

Inheritance diagram for GSViewport:

Static Public Member Functions

static void ScrollTo (TileIndex tile)
 Scroll the viewport to the given tile, where the tile will be in the center of the screen.
static bool ScrollEveryoneTo (TileIndex tile)
 Scroll the viewport of all players to the given tile, where the tile will be in the center of the screen.
static bool ScrollCompanyClientsTo (GSCompany::CompanyID company, TileIndex tile)
 Scroll the viewports of all players in the company to the given tile, where the tile will be in the center of the screen.
static bool ScrollClientTo (GSClient::ClientID client, TileIndex tile)
 Scroll the viewport of the client to the given tile, where the tile will be in the center of the screen.

Detailed Description

Class that manipulates the user's viewport.

Member Function Documentation

◆ ScrollClientTo()

bool GSViewport::ScrollClientTo ( GSClient::ClientID client,
TileIndex tile )
static

Scroll the viewport of the client to the given tile, where the tile will be in the center of the screen.

Parameters
clientThe client to scroll the viewport of.
tileThe tile to put in the center of the screen.
Precondition
GSGame::IsMultiplayer()
GSCompanyMode::IsDeity().
GSMap::IsValidTile(tile)
ResolveClientID(client) != CLIENT_INVALID
Returns
True iff the command was executed successfully.

◆ ScrollCompanyClientsTo()

bool GSViewport::ScrollCompanyClientsTo ( GSCompany::CompanyID company,
TileIndex tile )
static

Scroll the viewports of all players in the company to the given tile, where the tile will be in the center of the screen.

Parameters
companyThe company which players to scroll the viewport of.
tileThe tile to put in the center of the screen.
Precondition
GSCompanyMode::IsDeity().
GSMap::IsValidTile(tile)
ResolveCompanyID(company) != COMPANY_INVALID
Returns
True iff the command was executed successfully.

◆ ScrollEveryoneTo()

bool GSViewport::ScrollEveryoneTo ( TileIndex tile)
static

Scroll the viewport of all players to the given tile, where the tile will be in the center of the screen.

Parameters
tileThe tile to put in the center of the screen.
Precondition
GSCompanyMode::IsDeity().
GSMap::IsValidTile(tile)
Returns
True iff the command was executed successfully.

◆ ScrollTo()

void GSViewport::ScrollTo ( TileIndex tile)
static

Scroll the viewport to the given tile, where the tile will be in the center of the screen.

Parameters
tileThe tile to put in the center of the screen.
Precondition
! GSGame::IsMultiplayer().
GSMap::IsValidTile(tile).