micro optimization
This commit is contained in:
@@ -87,5 +87,5 @@
|
||||
#define MAX_KEYPRESS_COMMANDLENGTH 16
|
||||
///Max amount of keypress messages per second over two seconds before client is autokicked
|
||||
#define MAX_KEYPRESS_AUTOKICK 100
|
||||
///Length of held key rolling buffer
|
||||
#define HELD_KEY_BUFFER_LENGTH 15
|
||||
///Length of max held keys
|
||||
#define MAX_HELD_KEYS 15
|
||||
|
||||
+7
-11
@@ -238,27 +238,24 @@
|
||||
|
||||
return found_mobs
|
||||
|
||||
|
||||
/proc/get_hearers_in_view(R, atom/source)
|
||||
// Returns a list of hearers in view(R) from source (ignoring luminosity). Used in saycode.
|
||||
var/turf/T = get_turf(source)
|
||||
. = list()
|
||||
|
||||
if(!T)
|
||||
if(!(source = get_turf(source)))
|
||||
return
|
||||
. = list()
|
||||
|
||||
var/list/processing_list = list()
|
||||
if (R == 0) // if the range is zero, we know exactly where to look for, we can skip view
|
||||
processing_list += T.contents // We can shave off one iteration by assuming turfs cannot hear
|
||||
processing_list += source.contents // We can shave off one iteration by assuming turfs cannot hear
|
||||
else // A variation of get_hear inlined here to take advantage of the compiler's fastpath for obj/mob in view
|
||||
var/lum = T.luminosity
|
||||
T.luminosity = 6 // This is the maximum luminosity
|
||||
var/list/cachedview = view(R, T)
|
||||
var/lum = source.luminosity
|
||||
source.luminosity = 6 // This is the maximum luminosity
|
||||
var/list/cachedview = view(R, source)
|
||||
for(var/mob/M in cachedview)
|
||||
processing_list += M
|
||||
for(var/obj/O in cachedview)
|
||||
processing_list += O
|
||||
T.luminosity = lum
|
||||
source.luminosity = lum
|
||||
|
||||
while(processing_list.len) // recursive_hear_check inlined here
|
||||
var/atom/A = processing_list[1]
|
||||
@@ -275,7 +272,6 @@
|
||||
if(R)
|
||||
. |= get_hearers_in_view(R.canhear_range, R)
|
||||
|
||||
|
||||
#define SIGNV(X) ((X<0)?-1:1)
|
||||
|
||||
/proc/inLineOfSight(X1,Y1,X2,Y2,Z=1,PX1=16.5,PY1=16.5,PX2=16.5,PY2=16.5)
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
message_admins("Client [ckey] just attempted to send an invalid keypress. Keymessage was over [MAX_KEYPRESS_COMMANDLENGTH] characters, autokicking due to likely abuse.")
|
||||
QDEL_IN(src, 1)
|
||||
return
|
||||
|
||||
if(length(keys_held) > MAX_HELD_KEYS)
|
||||
keys_held.Cut(1,2)
|
||||
keys_held[_key] = TRUE
|
||||
var/movement = SSinput.movement_keys[_key]
|
||||
if(!(next_move_dir_sub & movement) && !keys_held["Ctrl"])
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
var/turf/oldturf = get_turf(myturf)
|
||||
var/turf/newturf = get_turf(loc)
|
||||
warning("A lighting object realised it's loc had changed in update() ([myturf]\[[myturf ? myturf.type : "null"]]([COORD(oldturf)]) -> [loc]\[[ loc ? loc.type : "null"]]([COORD(newturf)]))!")
|
||||
|
||||
qdel(src, TRUE)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user