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 from7c2e9027c2, "initial terrible AI player scripts" had it since57e5bb878a, jubot copied it since02ed11ac54, qbot copied it sinceb146f53d7bqbot-wc (later aegis) copied it since45ee419171, aegis copied it sincebcf7115b5c, petra copied it since97afd25171.d23b7deb98used Object.create correctly for new code in aegis that was adopted for petra too in97afd25171. Differential Revision: https://code.wildfiregames.com/D2238 Patch By: Krinkle This was SVN commit r22834.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user