From 159fd0bfc9eb87dd5b7fdc04236dd69f34053aee Mon Sep 17 00:00:00 2001 From: Albert Iordache Date: Thu, 29 Mar 2012 23:44:22 +0300 Subject: [PATCH] Fixed a runtime error related to the group_multiplier of an air mixture being 0 In certain cases, zones would be emptied completely of turfs, thereby causing division by zero errors in FEA due to operations involving group_multiplier. --- code/FEA/FEA_gas_mixture.dm | 4 +-- code/ZAS/Processing.dm | 32 +++++++++++-------- code/game/json.dm | 3 +- .../objects/items/weapons/mops_cleaners.dm | 4 +++ 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/code/FEA/FEA_gas_mixture.dm b/code/FEA/FEA_gas_mixture.dm index b712e736150..9de87065b9f 100644 --- a/code/FEA/FEA_gas_mixture.dm +++ b/code/FEA/FEA_gas_mixture.dm @@ -41,13 +41,13 @@ datum temperature = 0 //in Kelvin, use calculate_temperature() to modify - var/group_multiplier = 1 + group_multiplier = 1 //Size of the group this gas_mixture is representing. //=1 for singletons graphic - var/list/datum/gas/trace_gases = list() + list/datum/gas/trace_gases = list() tmp oxygen_archived diff --git a/code/ZAS/Processing.dm b/code/ZAS/Processing.dm index 517ce469829..4de6c939860 100644 --- a/code/ZAS/Processing.dm +++ b/code/ZAS/Processing.dm @@ -56,22 +56,26 @@ zone if(T.zone && T.zone != src) RemoveTurf(T) if(dbg_output) world << "Removed invalid turf." - else if(!T.zone) - T.zone = src + if(air.group_multiplier <= 0) // No more turfs belong to this zone, so we can get rid of it + del(src) + else // Turf was valid, so we can handle it + if(!T.zone) + T.zone = src - if(istype(T,/turf/simulated)) - var/turf/simulated/S = T - if(S.fire_protection) S.fire_protection-- - if(check) - if(S.HasDoor(1)) - S.update_visuals() - else - S.update_visuals(air) + if(istype(T,/turf/simulated)) + var/turf/simulated/S = T + if(S.fire_protection) S.fire_protection-- + if(check) + if(S.HasDoor(1)) + S.update_visuals() + else + S.update_visuals(air) + + if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) + for(var/atom/movable/item in S) + item.temperature_expose(air, air.temperature, CELL_VOLUME) + S.temperature_expose(air, air.temperature, CELL_VOLUME) - if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) - for(var/atom/movable/item in S) - item.temperature_expose(air, air.temperature, CELL_VOLUME) - S.temperature_expose(air, air.temperature, CELL_VOLUME) air.graphic_archived = air.graphic air.temperature = max(TCMB,air.temperature) diff --git a/code/game/json.dm b/code/game/json.dm index c1d94b08510..b76be26ea7e 100644 --- a/code/game/json.dm +++ b/code/game/json.dm @@ -98,5 +98,4 @@ proc/send2irc(msg,msg2) shell("python nudge.py [msg] [msg2]") proc/send2adminirc(channel,msg) world << channel << " "<< msg - shell("python nudge.py '[channel]' [msg]") -p //test \ No newline at end of file + shell("python nudge.py '[channel]' [msg]") \ No newline at end of file diff --git a/code/game/objects/items/weapons/mops_cleaners.dm b/code/game/objects/items/weapons/mops_cleaners.dm index 452313ceb6d..9cf664663e3 100644 --- a/code/game/objects/items/weapons/mops_cleaners.dm +++ b/code/game/objects/items/weapons/mops_cleaners.dm @@ -353,6 +353,10 @@ obj/item/weapon/mop/proc/clean(turf/simulated/A as turf) ..() /obj/item/weapon/mop/afterattack(atom/A, mob/user as mob) + if (isnull(A)) + user << "\red You've encountered a nasty bug. You should tell a developer what you were trying to clean with the mop." + return + if (src.reagents.total_volume < 1 || mopcount >= 5) user << "\blue Your mop is dry!" return