ID:151457
 
Well, just wanted an opinion on the best way to cache these icons, I made a map2icon type of thing where the map is all put into 1 icon and to do this I have to make a new icon for pretty much every turf. Putting these icons in a cache wouldn't have been too hard if I wans't manipulating all of them, yea I'm adding a lot to these icons and changing them quite a bit depending on how many atoms there are in one location, any ideas?
Without any specifics there's no way you'll get a useful answer.
In response to Garthor
There isn't much information to give. Basically I need a way to cache icons without having the icons in the cache be changed after I indirectly manipulate them...Now I'm confusing myself :(

Code:

proc
m_mapicon(var/Z=1, var/map_icon_size=16)
if(!Z) return 0
var/icon/return_icon = new('blank.dmi')
return_icon.Scale(world.maxx*map_icon_size, world.maxy*map_icon_size)
var/icon/temp
var/icon/temp2
var/turf/T
for(var/Y=1 to world.maxy)
for(var/X=1 to world.maxx)
T = locate(X,Y,Z)
if(!T) continue
if(T.icon&&!Exclude.Find("[T.type]"))
temp = icon(T.icon, T.icon_state, frame=1)
else
temp = new('blank.dmi')
temp.DrawBox(Empty_Color, 1, 1, temp.Width(), temp.Height())//This icon was changed
temp.Scale(map_icon_size, map_icon_size)//this was changed
for(var/atom/movable/A in T)
if(A.icon&&!Exclude.Find("[A.type]"))
temp2 = icon(A.icon, A.icon_state, frame=1)//Here I would use the cache proc...
temp2.Scale(map_icon_size,map_icon_size)//Changed Icon
temp.Blend(temp2, ICON_OVERLAY)//Changed Icon
return_icon.Blend(temp, ICON_OVERLAY, X*map_icon_size-map_icon_size, Y*map_icon_size-map_icon_size)
return return_icon

var/list/icon_cache = list()

proc
Icon(file,state,dir,frame,moving)//icon cache
var/a = "[file]_[state]_[dir]_[frame]_[moving]"
if(icon_cache.Find(a))
return icon_cache[a]
else
var/icon/I = icon(file,state,dir,frame,moving)
icon_cache+=a
icon_cache[a] = I
return icon_cache[a]