0ad/binaries/data/mods/_test.sim/globalscripts/test-global-helper.js
elexis 65b02395b3 Remove Vector2D/Vector3D prototype workaround from EngineScriptConversions.
Fixes #5376, refs #2394.
Differential Revision: https://code.wildfiregames.com/D1991
Patch By: Krinkle
Comments By: Vladislav, wraitii
This was SVN commit r22487.
2019-07-16 21:52:49 +00:00

41 lines
515 B
JavaScript

function GlobalSubtractionHelper(a, b)
{
return a-b;
}
function Vector2D(x, y)
{
if (arguments.length == 2)
{
this.x = x;
this.y = y;
}
else
this.x = this.y = 0;
}
Vector2D.prototype.add = function(v)
{
this.x += v.x;
this.y += v.y;
return this;
};
function Vector3D(x, y, z)
{
if (arguments.length == 3)
{
this.x = x;
this.y = y;
this.z = z;
}
else
this.x = this.y = this.z = 0;
}
Vector3D.prototype.add = function(v)
{
this.x += v.x;
this.y += v.y;
this.z += v.z;
return this;
};