From b92b1ef9a7ea14a4f6bbb04f8825af4bdc0ad3ba Mon Sep 17 00:00:00 2001 From: "johnsonmt88@gmail.com" Date: Fri, 15 Jun 2012 17:19:33 +0000 Subject: [PATCH] Quicker explosions: - This is more of a fix for the current method of explosions, not a fix to make explosions more efficient as a whole. - Explosions used circlerange() which had improperly named vars. At a glance, it looked like it was just returning turfs in range, but in reality it was returning all atoms in range. - Explosions now use circlerangeturfs() which only returns turfs circlerange() - Changed the variable names to reflect what they actually use to prevent this kind of confusion again. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@3832 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/procs/gamehelpers.dm | 14 +++++++------- code/game/objects/explosion.dm | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/code/defines/procs/gamehelpers.dm b/code/defines/procs/gamehelpers.dm index f74c7d9c1c3..069daa7fae2 100644 --- a/code/defines/procs/gamehelpers.dm +++ b/code/defines/procs/gamehelpers.dm @@ -51,17 +51,17 @@ /proc/circleview(center=usr,radius=3) var/turf/centerturf = get_turf(center) - var/list/turfs = new/list() + var/list/atoms = new/list() var/rsq = radius * (radius+0.5) - for(var/atom/T in view(radius, centerturf)) - var/dx = T.x - centerturf.x - var/dy = T.y - centerturf.y + for(var/atom/A in view(radius, centerturf)) + var/dx = A.x - centerturf.x + var/dy = A.y - centerturf.y if(dx*dx + dy*dy <= rsq) - turfs += T + atoms += A //turfs += centerturf - return turfs + return atoms /proc/get_dist_euclidian(atom/Loc1 as turf|mob|obj,atom/Loc2 as turf|mob|obj) var/dx = Loc1.x - Loc2.x @@ -84,7 +84,7 @@ turfs += T return turfs -/proc/circleviewturfs(center=usr,radius=3) +/proc/circleviewturfs(center=usr,radius=3) //Is there even a diffrence between this proc and circlerangeturfs()? var/turf/centerturf = get_turf(center) var/list/turfs = new/list() diff --git a/code/game/objects/explosion.dm b/code/game/objects/explosion.dm index 2232f91c36a..eba12f2f31a 100644 --- a/code/game/objects/explosion.dm +++ b/code/game/objects/explosion.dm @@ -26,10 +26,10 @@ proc/explosion(turf/epicenter, devastation_range, heavy_impact_range, light_impa var/list/fTurfs = list() //Holds turfs to loop through for mobs to flash. (Hehehe, dirty) if(roundExplosions) - fTurfs = circlerange(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range)) - dTurfs = circlerange(epicenter,devastation_range) - hTurfs = circlerange(epicenter,heavy_impact_range) - dTurfs - lTurfs = circlerange(epicenter,light_impact_range) - dTurfs - hTurfs + fTurfs = circlerangeturfs(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range)) + dTurfs = circlerangeturfs(epicenter,devastation_range) + hTurfs = circlerangeturfs(epicenter,heavy_impact_range) - dTurfs + lTurfs = circlerangeturfs(epicenter,light_impact_range) - dTurfs - hTurfs else fTurfs = range(epicenter,max(devastation_range, heavy_impact_range, light_impact_range, flash_range)) dTurfs = range(epicenter,devastation_range)