Change: Give AI/GSBridge::GetName an extra parameter to refer the vehicle type (#6988)

This commit is contained in:
SamuXarick
2019-01-31 23:08:03 +00:00
committed by Charles Pigott
parent 029c48cf4a
commit 1e5a6765d9
25 changed files with 214 additions and 21 deletions

View File

@@ -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)