Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

science: show max hull/shields, hide non-existing systems #2061

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/screens/crew6/scienceScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void ScienceScreen::onDraw(sp::RenderTarget& renderer)
info_type->setValue(ship->getTypeName());
info_type_button->show();
info_shields->setValue(ship->getShieldDataString());
info_hull->setValue(int(ceil(ship->getHull())));
info_hull->setValue(string(int(ceil(ship->getHull()))) + "/" + string(int(ceil(ship->getHullMax()))));
}

// On a full scan, show tactical and systems data (if any), and its
Expand Down Expand Up @@ -422,8 +422,12 @@ void ScienceScreen::onDraw(sp::RenderTarget& renderer)
// Show the status of each subsystem.
for(int n = 0; n < SYS_COUNT; n++)
{
float system_health = ship->systems[n].health;
info_system[n]->setValue(string(int(system_health * 100.0f)) + "%")->setColor(glm::u8vec4(255, 127.5f * (system_health + 1), 127.5f * (system_health + 1), 255));
if (ship->hasSystem(ESystem(n))) {
float system_health = ship->systems[n].health;
info_system[n]->setValue(string(int(system_health * 100.0f)) + "%")->setColor(glm::u8vec4(255, 127.5f * (system_health + 1), 127.5f * (system_health + 1), 255));
} else {
info_system[n]->setValue("-");
}
}
}
}
Expand All @@ -439,7 +443,7 @@ void ScienceScreen::onDraw(sp::RenderTarget& renderer)
{
info_type->setValue(station->template_name);
info_shields->setValue(station->getShieldDataString());
info_hull->setValue(int(ceil(station->getHull())));
info_hull->setValue(string(int(ceil(station->getHull()))) + "/" + string(int(ceil(station->getHullMax()))));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/spaceObjects/shipTemplateBasedObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ string ShipTemplateBasedObject::getShieldDataString()
{
if (n > 0)
data += ":";
data += string(int(shield_level[n]));
data += string(int(shield_level[n])) + "/" + string(int(shield_max[n]));
}
return data;
}
Loading