LDiCesare
Jun 16, 2007, 05:14 AM
The default normalizeAddRiver method is bugged:
It generates rivers near the playes' starting locations if it feels like a river is needed, but then the river can flow through deserts happily without producing any flood plains.
This is mostly obvious in map scripts that generate big deserts. Here's a (somewhat dirty) fix for it, which can be useful for any map script:
def normalizeRemovePeaks():
"A hack. I remove the peaks and I use this as it is the first method called after normalizeAddRiver, which needs a post treatment, so it comes here."
# Force flood plains
map = CyMap()
mapWidth = map.getGridWidth()
mapHeight = map.getGridHeight()
width = map.getGridWidth()
height = map.getGridHeight()
for x in range(width):
for y in range(height):
addFloodPlains(map.plot(x,y))
# And now the peaks.
CyPythonMgr().allowDefaultImpl()
This prevents this bad side effect and should probably be included in the C++ addRiver function instead, but it would be a pain to have a dll for a map script.
It generates rivers near the playes' starting locations if it feels like a river is needed, but then the river can flow through deserts happily without producing any flood plains.
This is mostly obvious in map scripts that generate big deserts. Here's a (somewhat dirty) fix for it, which can be useful for any map script:
def normalizeRemovePeaks():
"A hack. I remove the peaks and I use this as it is the first method called after normalizeAddRiver, which needs a post treatment, so it comes here."
# Force flood plains
map = CyMap()
mapWidth = map.getGridWidth()
mapHeight = map.getGridHeight()
width = map.getGridWidth()
height = map.getGridHeight()
for x in range(width):
for y in range(height):
addFloodPlains(map.plot(x,y))
# And now the peaks.
CyPythonMgr().allowDefaultImpl()
This prevents this bad side effect and should probably be included in the C++ addRiver function instead, but it would be a pain to have a dll for a map script.