Skip to content

Commit

Permalink
Fixes Issue tgstation#197 - "Camera Range Display" verb now uses obj/…
Browse files Browse the repository at this point in the history
…machinery/camera/proc/can_see() to calculate which turfs are visible by cameras.

Each turf in camera-range is marked with a maptext number indicating how many cameras can see that turf.

IMPORTANT: Changed the default fonts of the skinfile. This works around an issue with byond, where certain font-faces can cause HUGE increases in memory usage client-side, giving the illusion of lag, or severe crashes.
Before changing the font-face to 'Arial': using the camera range display verb would cause dream-seeker's memory usage to climb from 146,000 K to 800,000 K (and greater, but that is the limit of my laptop's pagefile, hence crashing my entire system)
After changing the font-face to 'Arial': using the same verb (with same code) resulted in negligible memory usage increase in dreamseeker, and works absolutely fine.

Status displays and such were not affected by this bug as they use a different font to the default set in the skinfile.
It did however affect stuff such as mining satchels, and may explain why some users found the game extremely 'laggy' or crashy
  • Loading branch information
carnie committed Apr 2, 2013
1 parent a7246ca commit d972a60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
34 changes: 12 additions & 22 deletions code/modules/admin/verbs/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,8 @@
//- Check for any misplaced or stacked piece of wire
//- Identify how hard it is to break into the area and where the weak points are
//- Check if the area has too much empty space. If so, make it smaller and replace the rest with maintenance tunnels.

var/camera_range_display_status = 0
var/intercom_range_display_status = 0

/obj/effect/debugging/camera_range
icon = 'icons/480x480.dmi'
icon_state = "25percent"

New()
src.pixel_x = -224
src.pixel_y = -224

/obj/effect/debugging/marker
icon = 'icons/turf/areas.dmi'
icon_state = "yellow"
Expand All @@ -47,19 +37,19 @@ var/intercom_range_display_status = 0
set category = "Mapping"
set name = "Camera Range Display"

if(camera_range_display_status)
camera_range_display_status = 0
else
camera_range_display_status = 1



for(var/obj/effect/debugging/camera_range/C in world)
del(C)

if(camera_range_display_status)
var/on = 0
for(var/turf/T in world)
if(T.maptext)
on = 1
T.maptext = null

if(!on)
var/list/seen = list()
for(var/obj/machinery/camera/C in cameranet.cameras)
new/obj/effect/debugging/camera_range(C.loc)
for(var/turf/T in C.can_see())
seen[T]++
for(var/turf/T in seen)
T.maptext = "[seen[T]]"
feedback_add_details("admin_verb","mCRD") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!


Expand Down
2 changes: 1 addition & 1 deletion interface/skin.dmf
Original file line number Diff line number Diff line change
Expand Up @@ -1306,7 +1306,7 @@ window "mapwindow"
size = 640x480
anchor1 = 0,0
anchor2 = 100,100
font-family = "Arial Rounded MT Bold,Arial Black,Arial,sans-serif"
font-family = "Arial"
font-size = 7
font-style = ""
text-color = none
Expand Down

0 comments on commit d972a60

Please sign in to comment.