OpenTTD GameScript API: GSViewport Class Reference

OpenTTD GameScript API 15.2

Static Public Member Functions
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()

static 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

  client | The client to scroll the viewport of.
  tile | The 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()

static 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

  company | The company which players to scroll the viewport of.
  tile | The 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()

static 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

  tile | The tile to put in the center of the screen.

Precondition
  GSCompanyMode::IsDeity().
  GSMap::IsValidTile(tile)

Returns
  True iff the command was executed successfully.

## ◆ ScrollTo()

static 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

  tile | The tile to put in the center of the screen.

Precondition
  ! GSGame::IsMultiplayer().
  GSMap::IsValidTile(tile).