mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 06:15:04 +00:00
Fix: ScriptRoad::HasRoadType really check for RoadType
Script::HasRoadType was only checking if the tile had the same RoadTramType as that of the RoadType provided. Now it really checks RoadType against RoadType.
This commit is contained in:
parent
45d98f689a
commit
3dda8c9bad
@ -379,3 +379,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -131,3 +131,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -68,3 +68,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -6,3 +6,16 @@
|
||||
*/
|
||||
|
||||
AILog.Info("1.10 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -6,3 +6,16 @@
|
||||
*/
|
||||
|
||||
AILog.Info("1.11 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ AIGroup.CreateGroup <- function(vehicle_type)
|
||||
{
|
||||
return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -6,3 +6,16 @@
|
||||
*/
|
||||
|
||||
AILog.Info("1.9 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -6,3 +6,16 @@
|
||||
*/
|
||||
|
||||
AILog.Info("12 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
AIRoad._HasRoadType <- AIRoad.HasRoadType;
|
||||
AIRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = AIRoadTypeList(AIRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (AIRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -13,3 +13,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -6,3 +6,16 @@
|
||||
*/
|
||||
|
||||
GSLog.Info("1.11 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -35,3 +35,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -35,3 +35,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -28,3 +28,15 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,3 +20,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -13,3 +13,16 @@ GSCompany.ChangeBankBalance <- function(company, delta, expenses_type)
|
||||
{
|
||||
return GSCompany._ChangeBankBalance(company, delta, expenses_type, GSMap.TILE_INVALID);
|
||||
}
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -6,3 +6,16 @@
|
||||
*/
|
||||
|
||||
GSLog.Info("12 API compatibility in effect.");
|
||||
|
||||
/* 13 really checks RoadType against RoadType */
|
||||
GSRoad._HasRoadType <- GSRoad.HasRoadType;
|
||||
GSRoad.HasRoadType <- function(tile, road_type)
|
||||
{
|
||||
local list = GSRoadTypeList(GSRoad.GetRoadTramType(road_type));
|
||||
foreach (rt, _ in list) {
|
||||
if (GSRoad._HasRoadType(tile, rt)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -20,6 +20,9 @@
|
||||
* \li AIIndustryType::ResolveNewGRFID
|
||||
* \li AIObjectType::ResolveNewGRFID
|
||||
*
|
||||
* Other changes:
|
||||
* \li AIRoad::HasRoadType now correctly checks RoadType against RoadType
|
||||
*
|
||||
* \b 12.0
|
||||
*
|
||||
* API additions:
|
||||
|
@ -20,6 +20,9 @@
|
||||
* \li GSIndustryType::ResolveNewGRFID
|
||||
* \li GSObjectType::ResolveNewGRFID
|
||||
*
|
||||
* Other changes:
|
||||
* \li GSRoad::HasRoadType now correctly checks RoadType against RoadType
|
||||
*
|
||||
* \b 12.0
|
||||
*
|
||||
* API additions:
|
||||
|
@ -98,7 +98,7 @@
|
||||
{
|
||||
if (!ScriptMap::IsValidTile(tile)) return false;
|
||||
if (!IsRoadTypeAvailable(road_type)) return false;
|
||||
return ::GetAnyRoadBits(tile, ::GetRoadTramType((::RoadType)road_type), false) != ROAD_NONE;
|
||||
return ::MayHaveRoad(tile) && HasBit(::GetPresentRoadTypes(tile), (::RoadType)road_type);
|
||||
}
|
||||
|
||||
/* static */ bool ScriptRoad::AreRoadTilesConnected(TileIndex t1, TileIndex t2)
|
||||
|
Loading…
Reference in New Issue
Block a user