Skip to content

Commit

Permalink
Removes total_moles_specific, just use gaslists normally. I don't kno…
Browse files Browse the repository at this point in the history
…w how I missed this (tgstation#57973)
  • Loading branch information
LemonInTheDark authored Mar 28, 2021
1 parent 6db794e commit c523705
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
6 changes: 0 additions & 6 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -538,12 +538,6 @@ GLOBAL_LIST_INIT(pipe_paint_colors, sortList(list(
out_var += cached_gases[total_moles_id][MOLES];\
}

#define TOTAL_MOLES_SPECIFIC(cached_gases, gas_id, out_var)\
out_var = 0;\
if(cached_gases[gas_id]){\
out_var = cached_gases[gas_id][MOLES];\
}

#ifdef TESTING
GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define CALCULATE_ADJACENT_TURFS(T, state) if (SSadjacent_air.queue[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSadjacent_air.queue[T] = state}
Expand Down
7 changes: 1 addition & 6 deletions code/modules/atmospherics/gasmixtures/gas_mixture.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/datum/gas_mixture/proc/total_moles()
var/cached_gases = gases
TOTAL_MOLES(cached_gases, .)

/// Calculate moles for a specific gas in the mixture
/datum/gas_mixture/proc/total_moles_specific(gas_id)
var/cached_gases = gases
TOTAL_MOLES_SPECIFIC(cached_gases, gas_id, .)


/// Checks to see if gas amount exists in mixture.
/// Do NOT use this in code where performance matters!
/// It's better to batch calls to garbage_collect(), especially in places where you're checking many gastypes
Expand Down
5 changes: 3 additions & 2 deletions code/modules/atmospherics/machinery/bluespace_vendor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@
///Check the price of the current tank, if the user doesn't have the money the gas will be merged back into the network
/obj/machinery/bluespace_vendor/proc/check_price(mob/user)
var/temp_price = 0
for(var/gas_id in internal_tank.air_contents.gases)
temp_price += internal_tank.air_contents.total_moles_specific(gas_id) * connected_machine.base_prices[gas_id]
var/list/gases = internal_tank.air_contents.gases
for(var/gas_id in gases)
temp_price += gases[gas_id][MOLES] * connected_machine.base_prices[gas_id]
gas_price = temp_price

if(attempt_charge(src, user, gas_price) & COMPONENT_OBJ_CANCEL_CHARGE)
Expand Down

0 comments on commit c523705

Please sign in to comment.