1 /*
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/>.
6  */
7 
8 /** @file script_viewport.hpp Everything to manipulate the user's viewport. */
9 
10 #ifndef SCRIPT_VIEWPORT_HPP
11 #define SCRIPT_VIEWPORT_HPP
12 
13 #include "script_object.hpp"
14 #include "script_client.hpp"
15 #include "script_company.hpp"
16 
17 /**
18  * Class that manipulates the user's viewport.
19  * @api game
20  */
21 class ScriptViewport : public ScriptObject {
22 public:
23 	/**
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).
29 	 */
30 	static void ScrollTo(TileIndex tile);
31 
32 	/**
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 ScriptObject::GetCompany() == OWNER_DEITY
37 	 * @pre ScriptMap::IsValidTile(tile)
38 	 */
39 	static bool ScrollEveryoneTo(TileIndex tile);
40 
41 	/**
42 	 * Scroll the viewports of all players in the company to the given tile,
43 	 *  where the tile will be in the center of the screen.
44 	 * @param company The company which players to scroll the viewport of.
45 	 * @param tile The tile to put in the center of the screen.
46 	 * @pre ScriptObject::GetCompany() == OWNER_DEITY
47 	 * @pre ScriptMap::IsValidTile(tile)
48 	 * @pre ResolveCompanyID(company) != COMPANY_INVALID
49 	 */
50 	static bool ScrollCompanyClientsTo(ScriptCompany::CompanyID company, TileIndex tile);
51 
52 	/**
53 	 * Scroll the viewport of the client to the given tile,
54 	 *  where the tile will be in the center of the screen.
55 	 * @param client The client to scroll the viewport of.
56 	 * @param tile The tile to put in the center of the screen.
57 	 * @pre ScriptGame::IsMultiplayer()
58 	 * @pre ScriptObject::GetCompany() == OWNER_DEITY
59 	 * @pre ScriptMap::IsValidTile(tile)
60 	 * @pre ResolveClientID(client) != CLIENT_INVALID
61 	 */
62 	static bool ScrollClientTo(ScriptClient::ClientID client, TileIndex tile);
63 };
64 
65 #endif /* SCRIPT_ADMIN_HPP */
66