-Optimized free looking more by using associated lists.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5009 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
giacomand@gmail.com
2012-11-05 15:46:03 +00:00
parent cf40395946
commit c3c6da1c4a
2 changed files with 8 additions and 8 deletions

View File

@@ -16,7 +16,7 @@ var/datum/cameranet/cameranet = new()
x &= ~0xf
y &= ~0xf
var/key = "[x],[y],[z]"
return key in chunks
return (chunks[key])
// Returns the chunk in the x, y, z.
// If there is no chunk, it creates a new chunk and returns that.
@@ -24,7 +24,7 @@ var/datum/cameranet/cameranet = new()
x &= ~0xf
y &= ~0xf
var/key = "[x],[y],[z]"
if(!(key in chunks))
if(!chunks[key])
chunks[key] = new /datum/camerachunk(null, x, y, z)
return chunks[key]
@@ -130,6 +130,6 @@ var/datum/cameranet/cameranet = new()
if(chunk)
if(chunk.changed)
chunk.hasChanged(1) // Update now, no matter if it's visible or not.
if(position in chunk.visibleTurfs)
if(chunk.visibleTurfs[position])
return 1
return 0

View File

@@ -47,7 +47,7 @@
// Called when a chunk has changed. I.E: A wall was deleted.
/datum/camerachunk/proc/visibilityChanged(turf/loc)
if(!(loc in visibleTurfs))
if(!visibleTurfs[loc])
return
hasChanged()
@@ -86,7 +86,7 @@
continue
for(var/turf/t in c.can_see())
newVisibleTurfs += t
newVisibleTurfs[t] = t
// Removes turf that isn't in turfs.
newVisibleTurfs &= turfs
@@ -110,7 +110,7 @@
for(var/turf in visRemoved)
var/turf/t = turf
if(t in obscuredTurfs)
if(obscuredTurfs[t])
if(!t.obscured)
t.obscured = image('icons/effects/cameravis.dmi', t, "black", 15)
@@ -141,7 +141,7 @@
for(var/turf/t in range(10, locate(x + 8, y + 8, z)))
if(t.x >= x && t.y >= y && t.x < x + 16 && t.y < y + 16)
turfs += t
turfs[t] = t
for(var/camera in cameras)
var/obj/machinery/camera/c = camera
@@ -152,7 +152,7 @@
continue
for(var/turf/t in c.can_see())
visibleTurfs += t
visibleTurfs[t] = t
// Removes turf that isn't in turfs.
visibleTurfs &= turfs