mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-18 20:19:11 +00:00
Fix #14362, 4b677e8256
: Don't crash old scripts doing silly instantiation (#14394)
This commit is contained in:
@@ -36,3 +36,11 @@ AITown.FoundTown <- function(tile, size, city, layout, name) { return AITown.Fou
|
||||
|
||||
AIVehicle.SetNameCompat14 <- AIVehicle.SetName;
|
||||
AIVehicle.SetName <- function(id, name) { return AIVehicle.SetNameCompat14(id, AICompat14.Text(name)); }
|
||||
|
||||
AIObject.constructorCompat14 <- AIObject.constructor;
|
||||
foreach(name, object in CompatScriptRootTable) {
|
||||
if (type(object) != "class") continue;
|
||||
if (!object.rawin("constructor")) continue;
|
||||
if (object.constructor != AIObject.constructorCompat14) continue;
|
||||
object.constructor <- function() : (name) { AILog.Error("'" + name + "' is not instantiable"); }
|
||||
}
|
||||
|
@@ -81,3 +81,11 @@ GSTown.FoundTown <- function(tile, size, city, layout, name) { return GSTown.Fou
|
||||
|
||||
GSVehicle.SetNameCompat14 <- GSVehicle.SetName;
|
||||
GSVehicle.SetName <- function(id, name) { return GSVehicle.SetNameCompat14(id, GSCompat14.Text(name)); }
|
||||
|
||||
GSObject.constructorCompat14 <- GSObject.constructor;
|
||||
foreach(name, object in CompatScriptRootTable) {
|
||||
if (type(object) != "class") continue;
|
||||
if (!object.rawin("constructor")) continue;
|
||||
if (object.constructor != GSObject.constructorCompat14) continue;
|
||||
object.constructor <- function() : (name) { GSLog.Error("'" + name + "' is not instantiable"); }
|
||||
}
|
||||
|
Reference in New Issue
Block a user