From c3c6da1c4afafc45da9932aac013df8f2b23de06 Mon Sep 17 00:00:00 2001 From: "giacomand@gmail.com" Date: Mon, 5 Nov 2012 15:46:03 +0000 Subject: [PATCH] -Optimized free looking more by using associated lists. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@5009 316c924e-a436-60f5-8080-3fe189b3f50e --- .../mob/living/silicon/ai/freelook/cameranet.dm | 6 +++--- code/modules/mob/living/silicon/ai/freelook/chunk.dm | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm index 79ca642942c..eb38495e641 100644 --- a/code/modules/mob/living/silicon/ai/freelook/cameranet.dm +++ b/code/modules/mob/living/silicon/ai/freelook/cameranet.dm @@ -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 \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/freelook/chunk.dm b/code/modules/mob/living/silicon/ai/freelook/chunk.dm index 976698ed22a..33dbfd09665 100644 --- a/code/modules/mob/living/silicon/ai/freelook/chunk.dm +++ b/code/modules/mob/living/silicon/ai/freelook/chunk.dm @@ -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