Skip to content

Commit

Permalink
nope, doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
jupyterkat committed Dec 1, 2023
1 parent 9c249c0 commit a9cbc71
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 31 deletions.
34 changes: 10 additions & 24 deletions src/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl GasArena {

mix.write_var_id(
byond_string!("_extools_pointer_gasmixture"),
&f32::from_bits(next_idx as u32).into(),
&(next_idx as f32).into(),
)
.unwrap();

Expand Down Expand Up @@ -227,7 +227,7 @@ impl GasArena {
.clear_with_vol(init_volume);
mix.write_var_id(
byond_string!("_extools_pointer_gasmixture"),
&f32::from_bits(idx as u32).into(),
&(idx as f32).into(),
)
.unwrap();
}
Expand Down Expand Up @@ -255,8 +255,7 @@ where
F: FnOnce(&Mixture) -> Result<T>,
{
GasArena::with_gas_mixture(
mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
f,
)
}
Expand All @@ -269,8 +268,7 @@ where
F: FnOnce(&mut Mixture) -> Result<T>,
{
GasArena::with_gas_mixture_mut(
mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
f,
)
}
Expand All @@ -283,12 +281,8 @@ where
F: FnOnce(&Mixture, &Mixture) -> Result<T>,
{
GasArena::with_gas_mixtures(
src_mix
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
arg_mix
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
src_mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
arg_mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
f,
)
}
Expand All @@ -301,12 +295,8 @@ where
F: FnOnce(&mut Mixture, &mut Mixture) -> Result<T>,
{
GasArena::with_gas_mixtures_mut(
src_mix
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
arg_mix
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
src_mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
arg_mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
f,
)
}
Expand All @@ -319,12 +309,8 @@ where
F: FnMut(&RwLock<Mixture>, &RwLock<Mixture>) -> Result<T>,
{
GasArena::with_gas_mixtures_custom(
src_mix
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
arg_mix
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize,
src_mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
arg_mix.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize,
f,
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ fn equalize_all_hook(gas_list: ByondValue) {
value
.read_number_id(byond_string!("_extools_pointer_gasmixture"))
.ok()
.map(|f| f.to_bits() as usize)
.map(|f| f as usize)
})
.collect::<BTreeSet<_>>();
GasArena::with_all_mixtures(move |all_mixtures| {
Expand Down
8 changes: 2 additions & 6 deletions src/turfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,7 @@ fn hook_register_turf(src: ByondValue, flag: ByondValue) {
if flag >= 0 {
let mut to_insert: TurfMixture = TurfMixture::default();
let air = src.read_var_id(byond_string!("air"))?;
to_insert.mix = air
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize;
to_insert.mix = air.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize;
to_insert.flags = SimulationFlags::from_bits_truncate(flag as u8);
to_insert.id = id;

Expand Down Expand Up @@ -542,9 +540,7 @@ fn update_visuals(src: ByondValue) -> Result<ByondValue> {
let mut overlay_types = Vec::new();
let gas_overlays =
byondapi::global_call::call_global_id(byond_string!("get_overlays"), &[])?;
let ptr = air
.read_number_id(byond_string!("_extools_pointer_gasmixture"))?
.to_bits() as usize;
let ptr = air.read_number_id(byond_string!("_extools_pointer_gasmixture"))? as usize;
GasArena::with_gas_mixture(ptr, |mix| {
mix.for_each_gas(|idx, moles| {
if let Some(amt) = gas::types::gas_visibility(idx) {
Expand Down

0 comments on commit a9cbc71

Please sign in to comment.