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

feat(UI): show ammo per shot for weapons that use it #6013

Merged
merged 1 commit into from
Jan 30, 2025
Merged
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
5 changes: 5 additions & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2515,6 +2515,11 @@
mod->ammo_data()->nname( mod->ammo_remaining() ) ) );
}

if( mod->ammo_required() > 1 ) {
info.emplace_back( "AMMO", string_format( "Uses <stat>%i</stat> ammo per shot",
mod->ammo_required() ) );
}

if( mod->get_gun_ups_drain() && parts->test( iteminfo_parts::AMMO_UPSCOST ) ) {
info.emplace_back( "AMMO",
string_format( vgettext( "Uses <stat>%i</stat> charge of UPS per shot",
Expand Down Expand Up @@ -6202,7 +6207,7 @@
if( char_storage != 0_ml ) {
// Cast up to 64 to prevent overflow. Dividing before would prevent this but lose data.
contents_volume += units::from_milliliter( static_cast<int64_t>( armor->storage.value() ) *
p.inv_volume().value() / char_storage.value() );

Check warning on line 6210 in src/item.cpp

View workflow job for this annotation

GitHub Actions / build

Division by zero [clang-analyzer-core.DivideZero]
}
}
}
Expand Down
Loading