1
0
forked from mirrors/0ad

AI prototype chain cleanup.

Use prototype = Object.create(parent) instead of prototype = new
parent(...) to avoid calling the constructor needlessly (as it is
redundant with the base constructor call in the constructor calls the
parent constructor).

Testfile reference comes from 7c2e9027c2,
"initial terrible AI player scripts" had it since 57e5bb878a,
jubot copied it since 02ed11ac54,
qbot copied it since b146f53d7b
qbot-wc (later aegis) copied it since 45ee419171,
aegis copied it since bcf7115b5c,
petra copied it since 97afd25171.

d23b7deb98 used Object.create correctly for new code in aegis that was
adopted for petra too in 97afd25171.

Differential Revision: https://code.wildfiregames.com/D2238
Patch By: Krinkle
This was SVN commit r22834.
This commit is contained in:
elexis
2019-09-02 17:33:59 +00:00
parent 86fc1cf99c
commit eb6f14a82d
2 changed files with 2 additions and 2 deletions
@@ -18,7 +18,7 @@ Engine.RegisterComponentType(IID_Test1, "TestScript1A", TestScript1A);
function TestScript1B() {}
TestScript1B.prototype = new TestScript1A();
TestScript1B.prototype = Object.create(TestScript1A.prototype);
TestScript1B.prototype.Init = function() {
this.x = 102000;
@@ -21,7 +21,7 @@ PETRA.PetraBot = function(settings)
this.savedEvents = {};
};
PETRA.PetraBot.prototype = new API3.BaseAI();
PETRA.PetraBot.prototype = Object.create(API3.BaseAI.prototype);
PETRA.PetraBot.prototype.CustomInit = function(gameState)
{