Opened 7 years ago
Closed 7 years ago
#4813 closed defect (fixed)
Cleanup ambiguous confusing rmgen2 globals
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Should Have | Milestone: | Alpha 23 |
Component: | Maps | Keywords: | |
Cc: | Patch: |
Description
rmgen2, originally introduced in r17903 does some confusing things that should be sorted out
1. Delete g_MapInfo:
This is a global attempting to remove duplication. But the name just confuses the reader who also encounters g_Map
and g_MapSettings
.
The property has the terrible characteristic of halfway being initialized in initMapSettings
and halfway in resetTerrain
. It's global reference requires rmgen2 maps to rewrite the entire terrain before doing anything else for no reason.
The global can be removed altogether as all properties can be removed.
Properties redundant with global getters:
numPlayers
isgetNumPlayers()
mapSize
, isgetMapSize()
mapArea
isgetMapArea()
teams
isgetTeams()
Properties that instead should be unified with rmgen1 duplication:
startAngle = randFloat(0, TWO_PI)
for radial player placementcenterOfMap
is not widely used in rmgen2 but many duplication thereof in rmgen1 can be found, so should be a more general unification
Properties completely broken:
mapRadius = -PI / 4
That's not a radius but the default building orientation. Thus the only use increateBase
is compeltely bonkers (doesn't place -PI/4 grass bushes).
Properties that should be arguments:
mapHeight
that's a bad one. In most cases it's the same asBaseHeight
from the JSON file, thus redundant withgetBaseMapHeight
. But in some cases (Frontier) the map changes (randomizes) the base height. Changingg_Map.BaseHeight
instead is impossible as of r20265 and shouldn't be done as it should rather be a function argument instead of a global.
2. Rename ambiguous rmgen2 functions:
getTeams
togetTeamsArray
to somewhat distinguish it fromsortPlayers
initBiome
sounds like it were an important init function of the random biome system, while it only does some forest floor initialization of rmgen2, so it should be renamed to reflect that.initMapSettings()
sounds like an important map initialization of rmgen1 but in fact only initialized the removed global and called the forest floor init function. This function can be removed.
In 20278: