summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/script/api/ai/ai_bridge.hpp.sq2
-rw-r--r--src/script/api/ai_changelog.hpp3
-rw-r--r--src/script/api/game/game_bridge.hpp.sq2
-rw-r--r--src/script/api/game_changelog.hpp3
-rw-r--r--src/script/api/script_bridge.cpp6
-rw-r--r--src/script/api/script_bridge.hpp4
6 files changed, 15 insertions, 5 deletions
diff --git a/src/script/api/ai/ai_bridge.hpp.sq b/src/script/api/ai/ai_bridge.hpp.sq
index d09f56421..9a9b22300 100644
--- a/src/script/api/ai/ai_bridge.hpp.sq
+++ b/src/script/api/ai/ai_bridge.hpp.sq
@@ -37,7 +37,7 @@ void SQAIBridge_Register(Squirrel *engine)
SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::IsValidBridge, "IsValidBridge", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::IsBridgeTile, "IsBridgeTile", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetBridgeID, "GetBridgeID", 2, ".i");
- SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetName, "GetName", 2, ".i");
+ SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetName, "GetName", 3, ".ii");
SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetPrice, "GetPrice", 3, ".ii");
SQAIBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxLength, "GetMaxLength", 2, ".i");
diff --git a/src/script/api/ai_changelog.hpp b/src/script/api/ai_changelog.hpp
index 03e9831a1..eb2b3a501 100644
--- a/src/script/api/ai_changelog.hpp
+++ b/src/script/api/ai_changelog.hpp
@@ -21,6 +21,9 @@
* API additions:
* \li AIAirport::GetMonthlyMaintenanceCost
*
+ * Other changes:
+ * \li AIBridge::GetName takes one extra parameter to refer the vehicle type
+ *
* \b 1.8.0
*
* No changes
diff --git a/src/script/api/game/game_bridge.hpp.sq b/src/script/api/game/game_bridge.hpp.sq
index 029a3ab3d..df0a94502 100644
--- a/src/script/api/game/game_bridge.hpp.sq
+++ b/src/script/api/game/game_bridge.hpp.sq
@@ -37,7 +37,7 @@ void SQGSBridge_Register(Squirrel *engine)
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::IsValidBridge, "IsValidBridge", 2, ".i");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::IsBridgeTile, "IsBridgeTile", 2, ".i");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetBridgeID, "GetBridgeID", 2, ".i");
- SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetName, "GetName", 2, ".i");
+ SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetName, "GetName", 3, ".ii");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetPrice, "GetPrice", 3, ".ii");
SQGSBridge.DefSQStaticMethod(engine, &ScriptBridge::GetMaxLength, "GetMaxLength", 2, ".i");
diff --git a/src/script/api/game_changelog.hpp b/src/script/api/game_changelog.hpp
index 7aad75b44..094449d73 100644
--- a/src/script/api/game_changelog.hpp
+++ b/src/script/api/game_changelog.hpp
@@ -28,6 +28,9 @@
* \li GSViewport::ScrollClientTo
* \li GSGoal::QuestionClient
*
+ * Other changes:
+ * \li GSBridge::GetName takes one extra parameter to refer the vehicle type
+ *
* \b 1.8.0
*
* No changes
diff --git a/src/script/api/script_bridge.cpp b/src/script/api/script_bridge.cpp
index 45bec466c..f532f11b7 100644
--- a/src/script/api/script_bridge.cpp
+++ b/src/script/api/script_bridge.cpp
@@ -16,6 +16,7 @@
#include "../../bridge_map.h"
#include "../../strings_func.h"
#include "../../date_func.h"
+#include "table/strings.h"
#include "../../safeguards.h"
@@ -135,11 +136,12 @@ static void _DoCommandReturnBuildBridge1(class ScriptInstance *instance)
return ScriptObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
}
-/* static */ char *ScriptBridge::GetName(BridgeID bridge_id)
+/* static */ char *ScriptBridge::GetName(BridgeID bridge_id, ScriptVehicle::VehicleType vehicle_type)
{
+ EnforcePrecondition(NULL, vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_WATER);
if (!IsValidBridge(bridge_id)) return NULL;
- return GetString(::GetBridgeSpec(bridge_id)->transport_name[0]);
+ return GetString(vehicle_type == ScriptVehicle::VT_WATER ? STR_LAI_BRIDGE_DESCRIPTION_AQUEDUCT : ::GetBridgeSpec(bridge_id)->transport_name[vehicle_type]);
}
/* static */ int32 ScriptBridge::GetMaxSpeed(BridgeID bridge_id)
diff --git a/src/script/api/script_bridge.hpp b/src/script/api/script_bridge.hpp
index e06928596..5327d4206 100644
--- a/src/script/api/script_bridge.hpp
+++ b/src/script/api/script_bridge.hpp
@@ -66,10 +66,12 @@ public:
/**
* Get the name of a bridge.
* @param bridge_id The bridge to get the name of.
+ * @param vehicle_type The vehicle-type of bridge to get the name of.
* @pre IsValidBridge(bridge_id).
+ * @pre vehicle_type == ScriptVehicle::VT_ROAD || vehicle_type == ScriptVehicle::VT_RAIL || vehicle_type == ScriptVehicle::VT_WATER
* @return The name the bridge has.
*/
- static char *GetName(BridgeID bridge_id);
+ static char *GetName(BridgeID bridge_id, ScriptVehicle::VehicleType vehicle_type);
/**
* Get the maximum speed of a bridge.