replace magic strings with constants
This commit is contained in:
parent
758114e3a2
commit
b9708f7839
|
@ -902,9 +902,9 @@ fn spawn_entities(
|
||||||
|
|
||||||
let orbited_mass: Option<f64> = if let Some(id) = &state.orbit_object_id {
|
let orbited_mass: Option<f64> = if let Some(id) = &state.orbit_object_id {
|
||||||
match id.as_str() {
|
match id.as_str() {
|
||||||
"jupiter" => Some(nature::JUPITER_MASS),
|
ID_JUPITER => Some(nature::JUPITER_MASS),
|
||||||
"earth" => Some(nature::EARTH_MASS),
|
ID_EARTH => Some(nature::EARTH_MASS),
|
||||||
"sol" => Some(nature::SOL_MASS),
|
ID_SOL => Some(nature::SOL_MASS),
|
||||||
_ => {
|
_ => {
|
||||||
error!("Found no mass for object `{id}`");
|
error!("Found no mass for object `{id}`");
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -501,7 +501,7 @@ fn update_id2pos(
|
||||||
id2pos.0.clear();
|
id2pos.0.clear();
|
||||||
for (pos, id) in &q_id {
|
for (pos, id) in &q_id {
|
||||||
id2pos.0.insert(id.0.clone(), pos.0);
|
id2pos.0.insert(id.0.clone(), pos.0);
|
||||||
if id.0 == "jupiter" {
|
if id.0 == cmd::ID_JUPITER {
|
||||||
jupiterpos.0 = pos.0;
|
jupiterpos.0 = pos.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -609,12 +609,12 @@ fn check_achievements(
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let pos_sun = if let Some(pos) = id2pos.0.get("sol") {
|
let pos_sun = if let Some(pos) = id2pos.0.get(cmd::ID_SOL) {
|
||||||
pos
|
pos
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
let pos_jupiter = if let Some(pos) = id2pos.0.get("jupiter") {
|
let pos_jupiter = if let Some(pos) = id2pos.0.get(cmd::ID_JUPITER) {
|
||||||
pos
|
pos
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue