Fix #14362, 4b677e8256: Don't crash old scripts doing silly instantiation (#14394)

This commit is contained in:
Loïc Guilloux
2025-07-17 13:30:33 +02:00
committed by GitHub
parent bccbd64037
commit 1b01a0636c
3 changed files with 28 additions and 0 deletions

View File

@@ -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"); }
}