summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/game/game_bridge.hpp.sq1
-rw-r--r--src/script/api/game/game_road.hpp.sq2
-rw-r--r--src/script/api/game/game_tile.hpp.sq1
-rw-r--r--src/script/api/game/game_tunnel.hpp.sq1
-rw-r--r--src/script/api/script_bridge.cpp2
-rw-r--r--src/script/api/script_bridge.hpp3
-rw-r--r--src/script/api/script_road.hpp4
-rw-r--r--src/script/api/script_tile.hpp1
-rw-r--r--src/script/api/script_tunnel.cpp2
-rw-r--r--src/script/api/script_tunnel.hpp3
10 files changed, 15 insertions, 5 deletions
diff --git a/src/script/api/game/game_bridge.hpp.sq b/src/script/api/game/game_bridge.hpp.sq
index d4c2d0583..56b327471 100644
--- a/src/script/api/game/game_bridge.hpp.sq
+++ b/src/script/api/game/game_bridge.hpp.sq
@@ -42,6 +42,7 @@ void SQGSBridge_Register(Squirrel *engine)
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetPrice, "GetPrice", 3, ".ii");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxLength, "GetMaxLength", 2, ".i");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMinLength, "GetMinLength", 2, ".i");
+ SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::BuildBridge, "BuildBridge", 5, ".iiii");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetOtherBridgeEnd, "GetOtherBridgeEnd", 2, ".i");
SQGSBridge.PostRegister(engine);
diff --git a/src/script/api/game/game_road.hpp.sq b/src/script/api/game/game_road.hpp.sq
index 5dd857ded..f398b6b00 100644
--- a/src/script/api/game/game_road.hpp.sq
+++ b/src/script/api/game/game_road.hpp.sq
@@ -59,6 +59,8 @@ void SQGSRoad_Register(Squirrel *engine)
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadDepotFrontTile, "GetRoadDepotFrontTile", 2, ".i");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetRoadStationFrontTile, "GetRoadStationFrontTile", 2, ".i");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetDriveThroughBackTile, "GetDriveThroughBackTile", 2, ".i");
+ SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildRoad, "BuildRoad", 3, ".ii");
+ SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::BuildRoadFull, "BuildRoadFull", 3, ".ii");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetBuildCost, "GetBuildCost", 3, ".ii");
SQGSRoad.DefSQStaticMethod(engine, &ScriptRoad::GetMaintenanceCostFactor, "GetMaintenanceCostFactor", 2, ".i");
diff --git a/src/script/api/game/game_tile.hpp.sq b/src/script/api/game/game_tile.hpp.sq
index 53e02578b..a25a175b5 100644
--- a/src/script/api/game/game_tile.hpp.sq
+++ b/src/script/api/game/game_tile.hpp.sq
@@ -77,6 +77,7 @@ void SQGSTile_Register(Squirrel *engine)
ScriptError::RegisterErrorMapString(ScriptTile::ERR_AREA_ALREADY_FLAT, "ERR_AREA_ALREADY_FLAT");
ScriptError::RegisterErrorMapString(ScriptTile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE");
+ SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsBuildable, "IsBuildable", 2, ".i");
SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsBuildableRectangle, "IsBuildableRectangle", 4, ".iii");
SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsWaterTile, "IsWaterTile", 2, ".i");
SQGSTile.DefSQStaticMethod(engine, &ScriptTile::IsCoastTile, "IsCoastTile", 2, ".i");
diff --git a/src/script/api/game/game_tunnel.hpp.sq b/src/script/api/game/game_tunnel.hpp.sq
index 49a6311de..e2d94bfcd 100644
--- a/src/script/api/game/game_tunnel.hpp.sq
+++ b/src/script/api/game/game_tunnel.hpp.sq
@@ -39,6 +39,7 @@ void SQGSTunnel_Register(Squirrel *engine)
SQGSTunnel.DefSQStaticMethod(engine, &ScriptTunnel::IsTunnelTile, "IsTunnelTile", 2, ".i");
SQGSTunnel.DefSQStaticMethod(engine, &ScriptTunnel::GetOtherTunnelEnd, "GetOtherTunnelEnd", 2, ".i");
+ SQGSTunnel.DefSQStaticMethod(engine, &ScriptTunnel::BuildTunnel, "BuildTunnel", 3, ".ii");
SQGSTunnel.PostRegister(engine);
}
diff --git a/src/script/api/script_bridge.cpp b/src/script/api/script_bridge.cpp
index da74712cc..c2cbfcde0 100644
--- a/src/script/api/script_bridge.cpp
+++ b/src/script/api/script_bridge.cpp
@@ -17,6 +17,7 @@
#include "../../strings_func.h"
#include "../../economy_func.h"
#include "../../date_func.h"
+#include "../../company_func.h"
/* static */ bool ScriptBridge::IsValidBridge(BridgeID bridge_id)
{
@@ -74,6 +75,7 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
EnforcePrecondition(false, TileX(start) == TileX(end) || TileY(start) == TileY(end));
EnforcePrecondition(false, vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_WATER);
EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_RAIL || ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType()));
+ EnforcePrecondition(false, _current_company != OWNER_DEITY || vehicle_type == ScriptVehicle::VT_ROAD);
uint type = 0;
switch (vehicle_type) {
diff --git a/src/script/api/script_bridge.hpp b/src/script/api/script_bridge.hpp
index 16fe8d6b8..267782603 100644
--- a/src/script/api/script_bridge.hpp
+++ b/src/script/api/script_bridge.hpp
@@ -135,6 +135,7 @@ public:
* ScriptMap::GetTileY(start) == ScriptMap::GetTileY(end).
* @pre vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_WATER ||
* (vehicle_type == ScriptVehicle::VT_RAIL && ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType())).
+ * @game @pre Outside CompanyMode: vehicle_type == ScriptVehicle::VT_ROAD.
* @exception ScriptError::ERR_ALREADY_BUILT
* @exception ScriptError::ERR_AREA_NOT_CLEAR
* @exception ScriptError::ERR_LAND_SLOPED_WRONG
@@ -143,9 +144,9 @@ public:
* @exception ScriptBridge::ERR_BRIDGE_CANNOT_END_IN_WATER
* @exception ScriptBridge::ERR_BRIDGE_HEADS_NOT_ON_SAME_HEIGHT
* @return Whether the bridge has been/can be build or not.
+ * @game @note Building a bridge (without CompanyMode) results in a bridge owned by towns.
* @note No matter if the road pieces were build or not, if building the
* bridge succeeded, this function returns true.
- * @api -game
*/
static bool BuildBridge(ScriptVehicle::VehicleType vehicle_type, BridgeID bridge_id, TileIndex start, TileIndex end);
diff --git a/src/script/api/script_road.hpp b/src/script/api/script_road.hpp
index c655ca51e..062a15ddf 100644
--- a/src/script/api/script_road.hpp
+++ b/src/script/api/script_road.hpp
@@ -265,8 +265,8 @@ public:
* @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
* @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
* @note Construction will fail if an obstacle is found between the start and end tiles.
+ * @game @note Building a piece of road (without CompanyMode) results in a piece of road owned by towns.
* @return Whether the road has been/can be build or not.
- * @api -game
*/
static bool BuildRoad(TileIndex start, TileIndex end);
@@ -317,8 +317,8 @@ public:
* @exception ScriptRoad::ERR_ROAD_WORKS_IN_PROGRESS
* @exception ScriptError::ERR_VEHICLE_IN_THE_WAY
* @note Construction will fail if an obstacle is found between the start and end tiles.
+ * @game @note Building a piece of road (without CompanyMode) results in a piece of road owned by towns.
* @return Whether the road has been/can be build or not.
- * @api -game
*/
static bool BuildRoadFull(TileIndex start, TileIndex end);
diff --git a/src/script/api/script_tile.hpp b/src/script/api/script_tile.hpp
index f5fe50993..e9155f745 100644
--- a/src/script/api/script_tile.hpp
+++ b/src/script/api/script_tile.hpp
@@ -130,7 +130,6 @@ public:
* as you can build tram-rails on road-tiles.
* @note For rail you also might want to check for ScriptRoad::IsRoad(),
* as in some cases you can build rails on road-tiles.
- * @api -game
*/
static bool IsBuildable(TileIndex tile);
diff --git a/src/script/api/script_tunnel.cpp b/src/script/api/script_tunnel.cpp
index 10b99d2f2..f851853c8 100644
--- a/src/script/api/script_tunnel.cpp
+++ b/src/script/api/script_tunnel.cpp
@@ -15,6 +15,7 @@
#include "../script_instance.hpp"
#include "../../tunnel_map.h"
#include "../../command_func.h"
+#include "../../company_func.h"
/* static */ bool ScriptTunnel::IsTunnelTile(TileIndex tile)
{
@@ -83,6 +84,7 @@ static void _DoCommandReturnBuildTunnel1(class ScriptInstance *instance)
EnforcePrecondition(false, ::IsValidTile(start));
EnforcePrecondition(false, vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_ROAD);
EnforcePrecondition(false, vehicle_type != ScriptVehicle::VT_RAIL || ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType()));
+ EnforcePrecondition(false, _current_company != OWNER_DEITY || vehicle_type == ScriptVehicle::VT_ROAD);
uint type = 0;
if (vehicle_type == ScriptVehicle::VT_ROAD) {
diff --git a/src/script/api/script_tunnel.hpp b/src/script/api/script_tunnel.hpp
index 1ae9c4d1b..fbd30b19e 100644
--- a/src/script/api/script_tunnel.hpp
+++ b/src/script/api/script_tunnel.hpp
@@ -87,6 +87,7 @@ public:
* @pre ScriptMap::IsValidTile(start).
* @pre vehicle_type == ScriptVehicle::VT_ROAD || (vehicle_type == ScriptVehicle::VT_RAIL &&
* ScriptRail::IsRailTypeAvailable(ScriptRail::GetCurrentRailType())).
+ * @game @pre Outside CompanyMode: vehicle_type == ScriptVehicle::VT_ROAD.
* @exception ScriptError::ERR_AREA_NOT_CLEAR
* @exception ScriptTunnel::ERR_TUNNEL_CANNOT_BUILD_ON_WATER
* @exception ScriptTunnel::ERR_TUNNEL_START_SITE_UNSUITABLE
@@ -96,7 +97,7 @@ public:
* @note The slope of a tile can be determined by ScriptTile::GetSlope(TileIndex).
* @note No matter if the road pieces were build or not, if building the
* tunnel succeeded, this function returns true.
- * @api -game
+ * @game @note Building a bridge (without CompanyMode) results in a bridge owned by towns.
*/
static bool BuildTunnel(ScriptVehicle::VehicleType vehicle_type, TileIndex start);