Runtime fix: getFlatIcon() - Will no longer runtime should overlays contain any nulls. (Interesting note: I was intending to fix this to try speed up update_icons() even more but it turns out BYOND really dislikes overlays += null. the optimisation took twice as long o.O)

Removed unused caching code from getFlatIcon(). We handle our own caching using datacore.dm

Runtime fix: datacore wasn't checking the type of object in the wear_id inventory slot. I've removed that so it now uses mind.assigned_role instead.
The following runtime has occured 1 time(s).
runtime error: undefined variable /obj/item/device/pda/warden/var/assignment
proc name: manifest (/obj/effect/datacore/proc/manifest)
  source file: datacore.dm,14
  usr: null
  src: the datacore (/obj/effect/datacore)

Runtime fix: staff-of-change projectiles were runtiminng when transforming somebody with implants. Cause: forgot a "continue" >.<
The following runtime has occured 4 time(s).
runtime error: Cannot modify null.layer.
proc name: wabbajack (/obj/item/projectile/change/proc/wabbajack)
  source file: change.dm,37
  usr: 0
  src: the bolt of change (/obj/item/projectile/change)



git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4412 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
elly1989@rocketmail.com
2012-08-14 23:46:03 +00:00
parent cece33ebde
commit e0b538ea77
3 changed files with 23 additions and 51 deletions

View File

@@ -23,11 +23,9 @@
/obj/effect/datacore/proc/manifest_inject(var/mob/living/carbon/human/H)
if(H.mind && (H.mind.assigned_role != "MODE"))
var/assignment
if(istype(H.wear_id))
var/obj/item/weapon/card/id/Card = H.wear_id
assignment = Card.assignment
else
if(H.job)
if(H.mind.assigned_role)
assignment = H.mind.assigned_role
else if(H.job)
assignment = H.job
else
assignment = "Unassigned"

View File

@@ -415,14 +415,10 @@ as a single icon. Useful for when you want to manipulate an icon via the above a
The _flatIcons list is a cache for generated icon files.
*/
// Associative list of [md5 values = Icon] for determining if the icon already exists
var/list/_flatIcons = list()
proc
getFlatIcon(atom/A, dir, cache=1) // 1 = use cache, 2 = override cache, 0 = ignore cache
getFlatIcon(atom/A, dir) // 1 = use cache, 2 = override cache, 0 = ignore cache
// Layers will be a sorted list of icons/overlays, based on the order in which they are displayed
var/list/layers = list()
var/hash = "" // Hash of overlay combination
// Add the atom's icon itself
if(A.icon)
@@ -434,18 +430,17 @@ proc
if(!dir) dir = A.dir
// Loop through the underlays, then overlays, sorting them into the layers list
var
list/process = A.underlays // Current list being processed
pSet=0 // Which list is being processed: 0 = underlays, 1 = overlays
curIndex=1 // index of 'current' in list being processed
current // Current overlay being sorted
currentLayer // Calculated layer that overlay appears on (special case for FLOAT_LAYER)
compare // The overlay 'add' is being compared against
cmpIndex // The index in the layers list of 'compare'
var/list/process = A.underlays // Current list being processed
var/pSet=0 // Which list is being processed: 0 = underlays, 1 = overlays
var/curIndex=1 // index of 'current' in list being processed
var/current // Current overlay being sorted
var/currentLayer // Calculated layer that overlay appears on (special case for FLOAT_LAYER)
var/compare // The overlay 'add' is being compared against
var/cmpIndex // The index in the layers list of 'compare'
while(TRUE)
if(curIndex<=process.len)
current = process[curIndex]
if(!current) continue
currentLayer = current:layer
if(currentLayer<0) // Special case for FLY_LAYER
if(currentLayer <= -1000) return 0
@@ -474,28 +469,14 @@ proc
else // All done
break
if(cache!=0) // If cache is NOT disabled
// Create a hash value to represent this specific flattened icon
for(var/I in layers)
hash += "\ref[I:icon],[I:icon_state],[I:dir ? I:dir : dir],[I:pixel_x],[I:pixel_y];_;"
hash=md5(hash)
if(cache!=2) // If NOT overriding cache
// Check if the icon has already been generated
for(var/h in _flatIcons)
if(h == hash)
// Icon already exists, just return that one
return _flatIcons[h]
var
// We start with a blank canvas, otherwise some icon procs crash silently
icon/flat = icon('icons/effects/effects.dmi', "icon_state"="nothing") // Final flattened icon
icon/add // Icon of overlay being added
var/icon/flat = icon('icons/effects/effects.dmi', "icon_state"="nothing") // Final flattened icon
var/icon/add // Icon of overlay being added
// Current dimensions of flattened icon
flatX1=1;flatX2=flat.Width();flatY1=1;flatY2=flat.Height()
var/{flatX1=1;flatX2=flat.Width();flatY1=1;flatY2=flat.Height()}
// Dimensions of overlay being added
addX1;addX2;addY1;addY2
var/{addX1;addX2;addY1;addY2}
for(var/I in layers)
@@ -532,10 +513,6 @@ proc
// Blend the overlay into the flattened icon
flat.Blend(add,ICON_OVERLAY,I:pixel_x+2-flatX1,I:pixel_y+2-flatY1)
if(cache!=0) // If cache is NOT disabled
// Cache the generated icon in our list so we don't have to regenerate it
_flatIcons[hash] = flat
return flat
getIconMask(atom/A)//By yours truly. Creates a dynamic mask for a mob/whatever. /N
@@ -557,14 +534,10 @@ proc
for(var/i=0,i<5,i++)//And now we add it as overlays. It's faster than creating an icon and then merging it.
var/image/I = image("icon" = opacity_icon, "icon_state" = A.icon_state, "layer" = layer+0.8)//So it's above other stuff but below weapons and the like.
switch(i)//Now to determine offset so the result is somewhat blurred.
if(1)
I.pixel_x -= 1
if(2)
I.pixel_x += 1
if(3)
I.pixel_y -= 1
if(4)
I.pixel_y += 1
if(1) I.pixel_x--
if(2) I.pixel_x++
if(3) I.pixel_y--
if(4) I.pixel_y++
overlays += I//And finally add the overlay.
/proc/getHologramIcon(icon/A, safety=1)//If safety is on, a new icon is not created.

View File

@@ -26,6 +26,7 @@
for(var/obj/item/W in M)
if(istype(W, /obj/item/weapon/implant)) //TODO: Carn. give implants a dropped() or something
del(W)
continue
W.layer = initial(W.layer)
W.loc = M.loc
W.dropped(M)