Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#4933 closed defect (fixed)

Remove rmgen Math proxies

Reported by: elexis Owned by: elexis
Priority: Nice to Have Milestone: Alpha 23
Component: Maps Keywords:
Cc: Patch:

Description

We have some proxies in rmgen/ and they don't really add anything besides giving two ways to call the same function:

function cos(x)
{
	return Math.cos(x);
}

function sin(x)
{
	return Math.sin(x);
}

function abs(x) {
	return Math.abs(x);
}

function round(x)
{
	return Math.round(x);
}

function sqrt(x)
{
	return Math.sqrt(x);
}

function floor(x)
{
	return Math.floor(x);
}

It was reported in a staff thread by fatherbushido and FeXoR mentioned agreement with deleting them.

https://wildfiregames.com/forum/index.php?/topic/21370-random-map-code-library-math-function-shortcut-usefull-or-not/

I recall leper asking for the proxies to be deleted too on irc 2015 or 2016, but I can't find it.

Change History (10)

comment:1 by elexis, 6 years ago

In r20789:
Remove rmgen Math.ceil proxy and unused lerp function from r9096.

comment:2 by elexis, 6 years ago

In 20792:

Remove unneeded rmgen min and max proxies, refs #4933.

comment:3 by elexis, 6 years ago

In 20793:

Remove rmgen sqrt proxy, refs #4933.

comment:4 by elexis, 6 years ago

In 20794:

Remove rmgen Math.floor proxy, refs #4933.

comment:5 by elexis, 6 years ago

In 20795:

Remove rmgen Math.abs proxy, refs #4933.

comment:6 by elexis, 6 years ago

In 20796:

Remove rmgen Math.round proxy, refs #4933.

comment:7 by elexis, 6 years ago

In 20798:

Replace TWO_PI with 2 * Math.PI, refs #4933.

comment:8 by elexis, 6 years ago

In 20815:

Implement random map script playerbase function.
Unifies 54 variants of the rmgen playerbase code, fixes #4805.

Add retry loops to prevent collisions of starting resources, fixes #4600 and
resources placed outside of the map area, fixes #4796.

Lays the foundation to test for collisions with Iberian walls, refs #2192 and
allows to rearrange the starting resources on all random maps without being confronted with code.

Delete remains of misc.js, leaving the rmgen files sorted by logic, fixes #4804.
Concludes what was started in rP18816, rP19282, specifically the 82 rmgen commits starting rP20115, rP20301.
Uses vector algebra, refs #4845.
Removes many Math proxy calls, refs #4933.
Removes 35 unused elevation and 24 unused cliffRadius variables, demonstrating the copy&paste antipattern.
Reduce iberian-wall hardcoding to one line, refs #4940.

comment:9 by elexis, 6 years ago

Owner: set to elexis
Resolution: fixed
Status: newclosed

In 20816:

Remove Math.sin, cos and PI proxy functions from rmgen. Fixes #4933.

comment:10 by elexis, 6 years ago

Milestone: BacklogAlpha 23
Priority: Should HaveNice to Have
Note: See TracTickets for help on using tickets.