prevent script error in cable station if other station could not be found

master
Maikel de Vries 2018-01-25 19:11:09 +01:00
parent e603bce240
commit b1d1079d88
1 changed files with 8 additions and 8 deletions

View File

@ -64,16 +64,16 @@ func Destruction()
{
for (var connection in FindObjects(Find_Func("IsConnectedTo", this)))
{
if (! connection->~IsCableLine()) continue;
if (!connection->~IsCableLine()) continue;
var other_crossing = connection->~GetConnectedObject(this);
if (! other_crossing->~IsCableCrossing()) continue;
if (!other_crossing || !other_crossing->~IsCableCrossing()) continue;
other_crossing->ClearConnections(this);
}
for (var connection in FindObjects(Find_Func("IsConnectedTo", this)))
{
if (! connection->~IsCableLine()) continue;
if (!connection->~IsCableLine()) continue;
var other_crossing = connection->~GetConnectedObject(this);
if (! other_crossing->~IsCableCrossing()) continue;
if (!other_crossing || !other_crossing->~IsCableCrossing()) continue;
other_crossing->RenewConnections(this);
}
return _inherited(...);
@ -319,9 +319,9 @@ public func ClearConnections(object crossing)
destination_list = [];
for (var connection in FindObjects(Find_Func("IsConnectedTo", this)))
{
if (! connection->~IsCableLine()) continue;
if (!connection->~IsCableLine()) continue;
var other_crossing = connection->~GetConnectedObject(this);
if (! other_crossing->~IsCableCrossing()) continue;
if (!other_crossing || !other_crossing->~IsCableCrossing()) continue;
other_crossing->ClearConnections();
}
}
@ -335,9 +335,9 @@ public func RenewConnections(object crossing)
clearing = false;
for(var connection in FindObjects(Find_Func("IsConnectedTo", this)))
{
if (! connection->~IsCableLine()) continue;
if (!connection->~IsCableLine()) continue;
var other_crossing = connection->~GetConnectedObject(this);
if (! other_crossing->~IsCableCrossing()) continue;
if (!other_crossing || !other_crossing->~IsCableCrossing()) continue;
if (other_crossing == crossing) continue;
destination_list[GetLength(destination_list)] = [other_crossing, other_crossing, ObjectDistance(other_crossing)];
AddCableDestinations(other_crossing->GetDestinations(), other_crossing);