Opened 7 years ago
Last modified 6 years ago
#4804 closed defect
Sort rmgen functions by logic — at Initial Version
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 23 |
Component: | Maps | Keywords: | |
Cc: | Patch: |
Description
The old school rmgen
directory is a bit messy, because three of the files don't have a clear separation of functions according to logic:
utilityfunctions.js
contains some frequently used elevation and entity placement helpers.- The filename is arbitrary and should be renamed before random unrelated code is added there.
- It could be split to
terrain_helpers.js
andplacer_helpers.js
or similar. - Its tileClass hardcodings can lead to reference errors and have to be removed.
misc.js
- contains some frequently helper functions for the starting base that should be moved to a new file
startingentities.js
. That file will be extended with new helper functions that will replace the duplication of the starting base code in every rmgen file. - contains some frequently used terrain and placer helper functions too.
- contains a lot of linear algebra unrelated to any rmgen implementation and should be moved to a new file
- contains some rmgen1 brand functions which are deeply connected to the code in
constraint.js
,tileclass.js
andpainter.js
and hence should be moved there - contains the four
modifyTilesBasedOnHeight
functions. They could be either moved to the three files above or the other short global helpers which don't fit anywhere inlibrary.js
.
- contains some frequently helper functions for the starting base that should be moved to a new file
library.js
:- contains some starting base functions which should be moved to the new file.
- contains some engine hardcodings, which should be replaced with an engine getter sometime (FeXoR ticket somewhere)
- contains some useful short globals like
fractionToTiles
- contains a lot of silly proxies like
sin = Math.sin
andPI = Math.PI
which should be deleted - contains some unrelated math helpers like
getAngle
orgetDistance
which can be moved to the new math file
After that, library.js
will be about 100 to 200 lines of code only, misc.js
and utilityfunctions.js
deleted. So it will be easier for new readers to understand the rmgen library.
Note:
See TracTickets
for help on using tickets.