summaryrefslogtreecommitdiff
path: root/src/script/api/script_viewport.hpp
diff options
context:
space:
mode:
authorPavel Stupnikov <dp@dpointer.org>2018-04-24 20:19:01 +0300
committerfrosch <github@elsenhans.name>2018-04-24 19:19:00 +0200
commit8e4bce58ea299527003cd2da5ef8dcb5f84b7f23 (patch)
tree021526d154b99ec8a3821fb83295685338cbee9f /src/script/api/script_viewport.hpp
parent34b63930f58aa12d008af6006411bd4492fa8a4e (diff)
downloadopenttd-8e4bce58ea299527003cd2da5ef8dcb5f84b7f23.tar.xz
Feature: GS methods to scroll viewport for players (#6745)
Diffstat (limited to 'src/script/api/script_viewport.hpp')
-rw-r--r--src/script/api/script_viewport.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/script/api/script_viewport.hpp b/src/script/api/script_viewport.hpp
index 542b58095..cae1a5930 100644
--- a/src/script/api/script_viewport.hpp
+++ b/src/script/api/script_viewport.hpp
@@ -13,6 +13,8 @@
#define SCRIPT_VIEWPORT_HPP
#include "script_object.hpp"
+#include "script_client.hpp"
+#include "script_company.hpp"
/**
* Class that manipulates the user's viewport.
@@ -28,6 +30,38 @@ public:
* @pre ScriptMap::IsValidTile(tile).
*/
static void ScrollTo(TileIndex tile);
+
+ /**
+ * Scroll the viewport of all players to the given tile,
+ * where the tile will be in the center of the screen.
+ * @param tile The tile to put in the center of the screen.
+ * @pre ScriptObject::GetCompany() == OWNER_DEITY
+ * @pre ScriptMap::IsValidTile(tile)
+ */
+ static bool ScrollEveryoneTo(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.
+ * @param company The company which players to scroll the viewport of.
+ * @param tile The tile to put in the center of the screen.
+ * @pre ScriptObject::GetCompany() == OWNER_DEITY
+ * @pre ScriptMap::IsValidTile(tile)
+ * @pre ResolveCompanyID(company) != COMPANY_INVALID
+ */
+ static bool ScrollCompanyClientsTo(ScriptCompany::CompanyID company, TileIndex tile);
+
+ /**
+ * Scroll the viewport of the client to the given tile,
+ * where the tile will be in the center of the screen.
+ * @param client The client to scroll the viewport of.
+ * @param tile The tile to put in the center of the screen.
+ * @pre ScriptGame::IsMultiplayer()
+ * @pre ScriptObject::GetCompany() == OWNER_DEITY
+ * @pre ScriptMap::IsValidTile(tile)
+ * @pre ResolveClientID(client) != CLIENT_INVALID
+ */
+ static bool ScrollClientTo(ScriptClient::ClientID client, TileIndex tile);
};
#endif /* SCRIPT_ADMIN_HPP */