Skip to content

Commit

Permalink
Fixes some awful defines to not be hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPerson committed Jan 23, 2016
1 parent a12cea1 commit e1b3815
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 20 deletions.
2 changes: 1 addition & 1 deletion code/ATMOSPHERICS/components/unary_devices/tank.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
if(gas_type)
air_contents.assert_gas(gas_type)
air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
name = "[name] ([air_contents.gases[gas_type][GAS_NAME]])"
name = "[name] ([air_contents.gases[gas_type][GAS_META][META_GAS_NAME]])"

/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
gas_type = "co2"
Expand Down
4 changes: 2 additions & 2 deletions code/LINDA/LINDA_turf_tile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@
var/list/gases = air.gases
for(var/id in gases)
var/gas = gases[id]
if(gas[GAS_OVERLAY] && gas[MOLES] > gas[MOLES_VISIBLE])
. += gas[GAS_OVERLAY]
if(gas[GAS_META][META_GAS_OVERLAY] && gas[MOLES] > gas[GAS_META][META_GAS_MOLES_VISIBLE])
. += gas[GAS_META][META_GAS_OVERLAY]

/turf/simulated/proc/share_air(turf/simulated/T)
if(T.current_cycle < current_cycle)
Expand Down
5 changes: 0 additions & 5 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,10 @@
#define MOLES 1
#define ARCHIVE 2
#define GAS_META 3
//this is kinda hacky... but it means I don't have to change every single time they're called.
#define META_GAS_SPECIFIC_HEAT 1
#define META_GAS_NAME 2
#define META_GAS_OVERLAY 4
#define META_GAS_MOLES_VISIBLE 3
#define SPECIFIC_HEAT GAS_META][META_GAS_SPECIFIC_HEAT
#define GAS_NAME GAS_META][META_GAS_NAME
#define GAS_OVERLAY GAS_META][META_GAS_OVERLAY
#define MOLES_VISIBLE GAS_META][META_GAS_MOLES_VISIBLE

//stuff you should probably leave well alone!
//ATMOS
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ var/list/WALLITEMS_INVERSE = list(
for(var/id in cached_gases)
var/gas_concentration = cached_gases[id][MOLES]/total_moles
if(id in hardcoded_gases || gas_concentration > 0.01) //ensures the four primary gases are always shown.
user << "<span class='notice'>[cached_gases[id][GAS_NAME]]: [round(gas_concentration*100)] %</span>"
user << "<span class='notice'>[cached_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100)] %</span>"

user << "<span class='notice'>Temperature: [round(air_contents.temperature-T0C)] &deg;C</span>"
else
Expand Down
6 changes: 3 additions & 3 deletions code/datums/gas_mixture.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ var/list/cached_gases_list = null
var/list/cached_gases = gases
. = 0
for(var/id in cached_gases)
. += cached_gases[id][MOLES]*cached_gases[id][SPECIFIC_HEAT]
. += cached_gases[id][MOLES]*cached_gases[id][GAS_META][META_GAS_SPECIFIC_HEAT]

/datum/gas_mixture/proc/heat_capacity_archived()
var/list/cached_gases = gases
. = 0
for(var/id in cached_gases)
. += cached_gases[id][ARCHIVE]*cached_gases[id][SPECIFIC_HEAT]
. += cached_gases[id][ARCHIVE]*cached_gases[id][GAS_META][META_GAS_SPECIFIC_HEAT]

/datum/gas_mixture/proc/total_moles()
var/list/cached_gases = gases
Expand Down Expand Up @@ -415,7 +415,7 @@ var/list/cached_gases_list = null
var/delta = QUANTIZE(gas[ARCHIVE] - sharergas[ARCHIVE])/(atmos_adjacent_turfs+1) //the amount of gas that gets moved between the mixtures

if(delta && abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/gas_heat_capacity = delta * gas[SPECIFIC_HEAT]
var/gas_heat_capacity = delta * gas[GAS_META][META_GAS_SPECIFIC_HEAT]
if(delta > 0)
heat_capacity_self_to_sharer += gas_heat_capacity
else
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/alarm.dm
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
continue
cur_tlv = TLV[gas_id]
environment_data += list(list(
"name" = env_gases[gas_id][GAS_NAME],
"name" = env_gases[gas_id][GAS_META][META_GAS_NAME],
"value" = env_gases[gas_id][MOLES] / total * 100,
"unit" = "%",
"danger_level" = cur_tlv.get_danger_level(env_gases[gas_id][MOLES] * partial_pressure)
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/computer/atmos_control.dm
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
)
var/total_moles = air_sample.total_moles()
for(var/gas_id in air_sample.gases)
var/gas_name = air_sample.gases[gas_id][GAS_NAME]
var/gas_name = air_sample.gases[gas_id][GAS_META][META_GAS_NAME]
signal.data["gases"][gas_name] = air_sample.gases[gas_id][MOLES] / total_moles * 100

radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/PDA/PDA.dm
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
for(var/id in env_gases)
var/gas_level = env_gases[id][MOLES]/total_moles
if(id in hardcoded_gases || gas_level > 0.01)
dat += "[env_gases[id][GAS_NAME]]: [round(gas_level*100)]%<br>"
dat += "[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_level*100)]%<br>"

dat += "Temperature: [round(environment.temperature-T0C)]&deg;C<br>"
dat += "<br>"
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/devices/scanners.dm
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ MASS SPECTROMETER
if(id in hardcoded_gases)
continue
var/gas_concentration = env_gases[id][MOLES]/total_moles
user << "<span class='alert'>[env_gases[id][GAS_NAME]]: [round(gas_concentration*100)] %</span>"
user << "<span class='alert'>[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100)] %</span>"
user << "<span class='info'>Temperature: [round(environment.temperature-T0C)] &deg;C</span>"


Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/debug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/t = ""
for(var/id in env_gases)
if(id in hardcoded_gases || env_gases[id][MOLES])
t+= "[env_gases[id][GAS_NAME]] : [env_gases[id][MOLES]]\n"
t+= "[env_gases[id][GAS_META][META_GAS_NAME]] : [env_gases[id][MOLES]]\n"

usr << t
feedback_add_details("admin_verb","ASL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/diagnostics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
usr << "<span class='adminnotice'>@[target.x],[target.y]: [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("\red BURNING"):(null)]</span>"
for(var/id in GM_gases)
if(id in hardcoded_gases || GM_gases[id][MOLES])
usr << "[GM_gases[id][GAS_NAME]]: [GM_gases[id][MOLES]]"
usr << "[GM_gases[id][GAS_META][META_GAS_NAME]]: [GM_gases[id][MOLES]]"
feedback_add_details("admin_verb","DAST") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

/client/proc/fix_next_move()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/silicon/pai/software.dm
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@
for(var/id in env_gases)
var/gas_level = env_gases[id][MOLES]/total_moles
if(id in hardcoded_gases || gas_level > 0.01)
dat += "[env_gases[id][GAS_NAME]]: [round(gas_level*100)]%<br>"
dat += "[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_level*100)]%<br>"
dat += "Temperature: [round(environment.temperature-T0C)]&deg;C<br>"
dat += "<a href='byond://?src=\ref[src];software=atmosensor;sub=0'>Refresh Reading</a> <br>"
dat += "<br>"
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var/next_mob_id = 0
for(var/id in environment.gases)
var/gas = environment.gases[id]
if(gas[MOLES])
t+="<span class='notice'>[gas[GAS_NAME]]: [gas[MOLES]] \n</span>"
t+="<span class='notice'>[gas[GAS_META][META_GAS_NAME]]: [gas[MOLES]] \n</span>"

usr << t

Expand Down

0 comments on commit e1b3815

Please sign in to comment.