diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm index 998c0fe5d6..28554dbd99 100644 --- a/code/__DEFINES/atmospherics.dm +++ b/code/__DEFINES/atmospherics.dm @@ -16,9 +16,6 @@ #define T0C 273.15 // 0degC #define T20C 293.15 // 20degC -//Quantization -#define ATMOS_QUANTIZATION_ACCURACY 0.0000001 //gases below this in mols are GC'd - #define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION)) //moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC #define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005) //compared against for superconductivity #define O2STANDARD 0.21 //percentage of oxygen in a normal mixture of air @@ -270,7 +267,7 @@ T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y; #define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity()) -#define QUANTIZE(variable) (round(variable,ATMOS_QUANTIZATION_ACCURACY))/*I feel the need to document what happens here. Basically this is used to catch most rounding errors, however it's previous value made it so that +#define QUANTIZE(variable) (round(variable,0.0000001))/*I feel the need to document what happens here. Basically this is used to catch most rounding errors, however it's previous value made it so that once gases got hot enough, most procedures wouldnt occur due to the fact that the mole counts would get rounded away. Thus, we lowered it a few orders of magnititude */ //prefer this to gas_mixture/total_moles in performance critical areas diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index 8f41cd621c..ca4b913369 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -238,24 +238,27 @@ 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. - if(!(source = get_turf(source))) - return + var/turf/T = get_turf(source) . = list() + if(!T) + return + 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 += source.contents // We can shave off one iteration by assuming turfs cannot hear + processing_list += T.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 = source.luminosity - source.luminosity = 6 // This is the maximum luminosity - var/list/cachedview = view(R, source) + var/lum = T.luminosity + T.luminosity = 6 // This is the maximum luminosity + var/list/cachedview = view(R, T) for(var/mob/M in cachedview) processing_list += M for(var/obj/O in cachedview) processing_list += O - source.luminosity = lum + T.luminosity = lum while(processing_list.len) // recursive_hear_check inlined here var/atom/A = processing_list[1] @@ -272,6 +275,7 @@ 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)