var gridSize = 200
var heightMap = new/list(gridSize,gridSize)
//This is the swapmap used to store the world map
var/swapmap/worldMap
turf/worldMap
icon = 'heightmap.dmi'
//This procedure is used to generate a new world map.
proc/generateWorldMap()
worldMap = new(WORLD_MAP_FILE,gridSize,gridSize,0)
_convertWorldTurfs()
_faultLines() //Populates the heightmap, no need to worry about this
_applyIcons()
//Used when the world map's turfs have been created
proc/_convertWorldTurfs()
for(var/turf/T in worldMap.AllTurfs())
new/turf/worldMap(T)
//This procedure is used to adjust the icon of every turf on the world map so
//that it is in line with its z index
proc/_applyIcons()
for(var/turf/T in worldMap.AllTurfs())
T.icon_state = "[heightMap[T.x][T.y]]"
mob/verb/testMap()
generateWorldMap()
usr.Move(worldMap.LoCorner())
Problem description:
When I generate a new world map all its icons are black. As far as I can tell, the map has been populated correctly. If I walk around using the following verb:
mob/verb/underFoot()
src<<"Loc = [loc.x] [loc.y]"
src<<"Type = [loc.type]"
src<<"HM = [heightMap[loc.x][loc.y]]"
src<<"IS = [loc.icon]:[loc.icon_state]"
src<<"OP = [loc.opacity]"
You can see that the turf's type, location, icon and icon_state have been set correctly.
Loc = 7 4
Type = /turf/worldMap
HM = 2
IS = heightmap.dmi:2
Op = 0
What else could be causing the icons to be black?
Notes:
- There is no default map file. The map is created using swapmaps (not sure if this is a problem)
- The icons aren't even going to their default icon state, just remaining black.
Edit:
I found out what the problem was. I had set client.view to the size of the world map before generating the map.
I don't see anything wrong with that (I don't use swap maps, though), but maybe you should make sure you didn't mess with the icon at all during generation.