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 {
|
||||
match id.as_str() {
|
||||
"jupiter" => Some(nature::JUPITER_MASS),
|
||||
"earth" => Some(nature::EARTH_MASS),
|
||||
"sol" => Some(nature::SOL_MASS),
|
||||
ID_JUPITER => Some(nature::JUPITER_MASS),
|
||||
ID_EARTH => Some(nature::EARTH_MASS),
|
||||
ID_SOL => Some(nature::SOL_MASS),
|
||||
_ => {
|
||||
error!("Found no mass for object `{id}`");
|
||||
continue;
|
||||
|
|
|
@ -501,7 +501,7 @@ fn update_id2pos(
|
|||
id2pos.0.clear();
|
||||
for (pos, id) in &q_id {
|
||||
id2pos.0.insert(id.0.clone(), pos.0);
|
||||
if id.0 == "jupiter" {
|
||||
if id.0 == cmd::ID_JUPITER {
|
||||
jupiterpos.0 = pos.0;
|
||||
}
|
||||
}
|
||||
|
@ -609,12 +609,12 @@ fn check_achievements(
|
|||
} else {
|
||||
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
|
||||
} else {
|
||||
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
|
||||
} else {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue