2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 /** @file script_viewport.hpp Everything to manipulate the user's viewport. */
10 #ifndef SCRIPT_VIEWPORT_HPP
11 #define SCRIPT_VIEWPORT_HPP
13 #include "script_object.hpp"
14 #include "script_client.hpp"
15 #include "script_company.hpp"
18 * Class that manipulates the user's viewport.
21 class ScriptViewport
: public ScriptObject
{
24 * Scroll the viewport to the given tile, where the tile will be in the
25 * center of the screen.
26 * @param tile The tile to put in the center of the screen.
27 * @pre ! ScriptGame::IsMultiplayer().
28 * @pre ScriptMap::IsValidTile(tile).
30 static void ScrollTo(TileIndex tile
);
33 * Scroll the viewport of all players to the given tile,
34 * where the tile will be in the center of the screen.
35 * @param tile The tile to put in the center of the screen.
36 * @pre ScriptCompanyMode::IsDeity().
37 * @pre ScriptMap::IsValidTile(tile)
38 * @return True iff the command was executed successfully.
40 static bool ScrollEveryoneTo(TileIndex tile
);
43 * Scroll the viewports of all players in the company to the given tile,
44 * where the tile will be in the center of the screen.
45 * @param company The company which players to scroll the viewport of.
46 * @param tile The tile to put in the center of the screen.
47 * @pre ScriptCompanyMode::IsDeity().
48 * @pre ScriptMap::IsValidTile(tile)
49 * @pre ResolveCompanyID(company) != COMPANY_INVALID
50 * @return True iff the command was executed successfully.
52 static bool ScrollCompanyClientsTo(ScriptCompany::CompanyID company
, TileIndex tile
);
55 * Scroll the viewport of the client to the given tile,
56 * where the tile will be in the center of the screen.
57 * @param client The client to scroll the viewport of.
58 * @param tile The tile to put in the center of the screen.
59 * @pre ScriptGame::IsMultiplayer()
60 * @pre ScriptCompanyMode::IsDeity().
61 * @pre ScriptMap::IsValidTile(tile)
62 * @pre ResolveClientID(client) != CLIENT_INVALID
63 * @return True iff the command was executed successfully.
65 static bool ScrollClientTo(ScriptClient::ClientID client
, TileIndex tile
);
68 #endif /* SCRIPT_ADMIN_HPP */